I'm trying to use the "fwrite" command to write some values to a data file. However, when I tried to read the text (integers) from the data file, the resulting values in the file couldn't be recognised (doesn't look like binaries as well). Do I need some form of conversion?
I'm new to C programming. Can anyone advise me what I could have done wrong when using the fwrite command?
I'm using an example to illustrate the way which I have used fwrite to store the values in the file.
Thanks for any help in advance.Code:
int data =
size_t obj_size = sizeof(int);
size_t obj_cnt = 12;
char *filename= "output.dat";
fwrite(&data, obj_size, obj_cnt, p_file);