The file created in your program is a text file (c.f. you may add 't' to make sure that it is a text file, i.e. "rw+t"). If you open the file to see what are in it, you should be able to see character strings but not integers which you have written to the file. The integers are not chacracters and will look like garbage in your file.