PDA

View Full Version : MaxScript::WriteString


HamidGL
09-30-2009, 11:19 PM
Hi,
I want to write a string variable and next a float variable in a file by maxscript,
i wrote this code for do it:

fileh = fopen "d:/ghjk.txt" "wb"
string1 = "hamidrezamehrabian"
float1 = 77.5876
writeString fileh string1
writeFloat fileh float1
fclose fileh

then i want to read the file by c++ ,
struct Test{
char String1[256];
float float1;
};
int main(int argc, char* argv[])
{
FILE *file = fopen("d:/ghjk.txt","rb");
Test Test0;
memset(&Test0,0,sizeof(Test0));
fread(&Test0,sizeof(Test0),1,file);
fclose(file);
printf("%s\n%f\n",Test0.String1,Test0.float1);
return 0;
}

But when i want to read this file ,
Only Read String value and cant read float value.Why?
Please Help Me..

CGTalk Moderation
09-30-2009, 11:19 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.