like fputs() for string,is there anything for writing integers? further can a structure be used to write in txt file?
like fputs() for string,is there anything for writing integers? further can a structure be used to write in txt file?
Do you want the binary value or the converted readable text value of the number written the file? For the former, you'd want fwrite. For the later you'd likely use fprintf.
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens
fprintf is like this:
so to write integer 'Cash' to FILE stream:Code:fprintf(FILE *stream, char *args, ...);
Code:fprintf(stream, "%d", cash);