fwrite() writes bytes to the file.
So if you have for example an int value 10 and your system uses 4 bytes for an int, then on a little endian system the value is stored as 0a 00 00 00 and on a big endian system it is stored as 00 00 00 0a. fwrite() will write these 4 bytes to the file.
If you open the file in a text editor, the editor interprets these bytes as characters (in ASCII one byte/character). That's why you get strange symbols.
You should write the numbers to your text file with fprintf().
Bye, Andreas