How to save data to file?
I''am converting one fileformat to other. And i use fwrite() for saving but it doesn''t work.
Could you help me? Please!!!
Still not enough info, what doesnt work!
"There is humor in everything depending on which prespective you look from."
"There is humor in everything depending on which prespective you look from."
try thist example. you could you also fprintf.
void Write(void)
{
FILE * pFile;
char buffer2[8]="try this";
fwrite (buffer , 1 , 8 , pFile);
fclose (pFile);
}
Visit my web site www.web-discovery.net !
void Write(void)
{
FILE * pFile;
char buffer2[8]="try this";
fwrite (buffer , 1 , 8 , pFile);
fclose (pFile);
}
Visit my web site www.web-discovery.net !
3 problems I see right away
void Write(void)
{
FILE * pFile;
char buffer2[8]="try this"; // the buffer2 is too small it needs to be longer for the NULL char at the end of the string
// next you need to actually open the file and have a FILE pointer
// pfile = fopen(buffer2,"wt");
// what the hell is ''buffer'' What happened to ''buffer2'' ??
fwrite (buffer , 1 , 8 , pFile);
fclose (pFile);
}
You are just typing, not programming.
Find a book that covers the basics. I''ve programmed as a hobby for 3 or 4 years and I still use one.
ZoomBoy
Developing a iso-tile 2D RPG with skills, weapons, and adventure. See my old Hex-Tile RPG GAME, character editor, diary, 3D Art resources at Check out my web-site
void Write(void)
{
FILE * pFile;
char buffer2[8]="try this"; // the buffer2 is too small it needs to be longer for the NULL char at the end of the string
// next you need to actually open the file and have a FILE pointer
// pfile = fopen(buffer2,"wt");
// what the hell is ''buffer'' What happened to ''buffer2'' ??
fwrite (buffer , 1 , 8 , pFile);
fclose (pFile);
}
You are just typing, not programming.
Find a book that covers the basics. I''ve programmed as a hobby for 3 or 4 years and I still use one.
ZoomBoy
Developing a iso-tile 2D RPG with skills, weapons, and adventure. See my old Hex-Tile RPG GAME, character editor, diary, 3D Art resources at Check out my web-site
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement