binary and text files ideas are really baggage from windows. The unix file system does not know about binary and text. Simply using fopen("filename", "wb") (open for binary writing) will not make the text unreadable. If you are doing this to hide passwords - don't ever try to write security stuff to a file without real encryption.
Bad idea.
If the information is sensitive, try crpyt. You edit a file then use crpyt to encrypt it.
crypt also decrypts the data. While crypt is not perfect protection it is okay inside the confines of a secure system.
If you are sending this data out on the internet try GNU gpg.
If you are just playing, look into XOR "encryption"
XOR cipher - Wikipedia, the free encyclopedia
The XOR bitwise operator ^ in C can do this for you.