You can write ints directly to a file, but then that file will not be a text file, and you will not be able to meaningfully read that file as text. This is called serialization.
Code:
#include <stdio.h>
int main(void) {
FILE *fp = fopen("test.data","wb");
int nums[] = { 1, 0, 666, -2436523 }, copy[4], i;
fwrite(nums,sizeof(int),4,fp);
fclose(fp);
fp=fopen("test.ints","rb");
fread(copy,sizeof(int),4,fp);
fclose(fp);
for(i=0;i<4;i++) printf("%d\n",copy[i]);
return 0;
}
Notice that fwrite and fread use "wb" and "rb" for write/read binary. This is important.
The reason you cannot read the file as text is that text is a series of one byte char ascii values. An int is a four byte "little endian" value.