: : Can anyone please help me to write an integer to a file. I know how to write a character and a string to a file but I can't find anything that says how to write an integer to a file. Either that or convert an integer into a string. There are many resources that tell me how to convert a string to an integer but none that say how to convert an integer to a string. Thanks a lot for your help.
: Look in any c programming book or google and you will find how to use printf() to store any data type to a file.
: Here is an example of storing an integer
: int n = 123;
: FILE* fp = fopen(....)
Or if you need to write the integer in a binary file..
void writeInteger(int integer)
FILE *fp = fopen("test.dat", "wb");
if( fp )
fwrite(&integer, sizeof(int), 1, fp);
To understand recursive, first you need to understand recursive