Writing a file in Binary

Hello All,

I need to read values from database and then need to write to a file. Planning to do that as binary since no one can modify the values. We tried to write the file in "B" mode and the file is created but when I try to open in notepad I am able to do. I there a way that someone should not open the file and the data in the file should not be readable. I know Encryption is one option is there a way I can make the file as binary

Thanks
Arun

What do you mean by "binary"? If there's text in that DB, its binary representation will be text again unless you convert it, which can be reverted, or encrypt it, as you know. For numbers, you could write their binary representation, but that would need a specific program to be written, and it is system dependent and may lead to difficulties when transferred to another host. And, it can of course be read by another program, should the data structure be known.

Thanks. So what I am asking is basically not possible without encryption. right ?

Thanks
Arun

you can always archive the file with tar of compress it it will then not be readable as, but that will not stop someone to unarchive or uncompress it to see the content...

I'm not sure if what you're asking makes sense either way, really. Binary is not a magic "works for me but nobody else" mode. Neither is encryption (if your program can access the password, so can people!)

Why not actually deny people the ability to read the file, with access permissions?