Hi, I want to know how to make a simple action in C.
Open a file and then write in the same line a simple thing:
first a char[30] thats means the name of a player and after 4 spaces or better a \t I need to write his scores.
How should I make this?
I tried to make a simple thing, but didnt worked.
Here is the code, my problems is writing the spaces and the score.. the name I writed perfectly
Code:
void saverecord(void)
{
FILE *fp; //The file...
//Open the file!
if((fp = fopen("scores.dat","a")) == NULL)
{
printf("Error! Cannot open the file!\n");
msleep(1); //Delay...
exit(1); //Exit...
}
//Write #HERE I NEED HELP#
fwrite(name, sizeof(name),1,fp);
//Now I havent any idea how to make the spaces and to
//output the number two...
//Close the file
fclose(fp);
}
Thanks for helping!