I don't have a clue about binary files. I'm a good programmer, have read more programming books than I can count, but still have no knowlege about binary files. Can you read them? Will they look like text? Is it good to use them? How can I print to a binary file, and then retreive from a binary file?
...
[hr]
~~[blue]Perl[/blue]~~[red]Visual Basic[/red]~~[green]JavaScript[/green]~~
SuperJoe
Comments
You can certainly open one up in a text editor and see what happens.
: Will they look like text?
Only if they have text embedded in them. Try opening up a .EXE in Notepad. Most of it will just look like garbage, though. Unless you use a "hex editor" which will show you the hexadecimal representation of the file contents. Some will also show you the parts that are text if there are any.
: Is it good to use them?
Depends what you want to do.
: How can I print to a binary file, and then retreive from a binary file?
Why do you want to?
: You can certainly open one up in a text editor and see what happens.
:
: : Will they look like text?
:
: Only if they have text embedded in them. Try opening up a .EXE in Notepad. Most of it will just look like garbage, though. Unless you use a "hex editor" which will show you the hexadecimal representation of the file contents. Some will also show you the parts that are text if there are any.
:
[blue]I have opened them up in notepad. Many times.[/blue]
: : Is it good to use them?
:
: Depends what you want to do.
[blue]I want the files to not be able to be edited by malicious people who find the program files and change them[/blue]
:
: : How can I print to a binary file, and then retreive from a binary file?
:
: Why do you want to?
:
[blue]Ditto[/blue]
~~[blue]Perl[/blue]~~[red]Visual Basic[/red]~~[green]JavaScript[/green]~~
SuperJoe30@juno.com
: : You can certainly open one up in a text editor and see what happens.
: :
: : : Will they look like text?
: :
: : Only if they have text embedded in them. Try opening up a .EXE in Notepad. Most of it will just look like garbage, though. Unless you use a "hex editor" which will show you the hexadecimal representation of the file contents. Some will also show you the parts that are text if there are any.
: :
:
: [blue]I have opened them up in notepad. Many times.[/blue]
:
:
: : : Is it good to use them?
: :
: : Depends what you want to do.
:
:
: [blue]I want the files to not be able to be edited by malicious people who find the program files and change them[/blue]
[red] The binary files are not protected against that. After you build/create the file you can set its property to readonly. That'll help a litle bit [/red]
:
:
: :
: : : How can I print to a binary file, and then retreive from a binary file?
: :
: : Why do you want to?
: :
:
: [blue]Ditto[/blue]
[red] We can read about binary files at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconusingbinaryfileaccess.asp [/red]
:
: ~~[blue]Perl[/blue]~~[red]Visual Basic[/red]~~[green]JavaScript[/green]~~
: SuperJoe30@juno.com
:
:
: [blue]I want the files to not be able to be edited by malicious people who find the program files and change them[/blue]
What you want is encrypted files, not binary. Binary files are just files and anyone with a hex editor could modify them. About the only way I can think of to protect your files from others (other than encryption) is to put them in a directory where only you have permissions. I'm not sure exactly how this would be done in Windows. Microsoft isn't known for making much of an effort at operating system security.
This is espeicially for true CPU bound binary files that have been programmed without an multi-proces OS like Z80.
: [b][red]This message was edited by infidel at 2002-10-3 11:40:12[/red][/b][hr]
: : [blue]I want the files to not be able to be edited by malicious people who find the program files and change them[/blue]
:
: What you want is encrypted files, not binary. Binary files are just files and anyone with a hex editor could modify them. About the only way I can think of to protect your files from others (other than encryption) is to put them in a directory where only you have permissions. I'm not sure exactly how this would be done in Windows. Microsoft isn't known for making much of an effort at operating system security.
:
:
:
[HR]
[CODE]
This is my signature! Do you believe it?
[/CODE]
[HR]
: [red] The binary files are not protected against that. After you build/create the file you can set its property to readonly. That'll help a litle bit [/red]
OK, I figured out how to do that. But can my program still read and write them?
Also, would setting them to hidden do me any good?
: [b][red]This message was edited by superjoe30 at 2002-10-4 10:38:28[/red][/b][hr]
: : [red] The binary files are not protected against that. After you build/create the file you can set its property to readonly. That'll help a litle bit [/red]
:
:
: OK, I figured out how to do that. But can my program still read and write them?
No. You have to change file attributes programmaticaly before you start to write to file then change back to readonly.
:
: Also, would setting them to hidden do me any good?
For smart experienced people it's not very difficult to change your file attributes. You can hide it but there is Win Options, which made hidden files visible. The same about read-only/archive properties. Infidel is right. There is no much security working with OS Win. There is only one way to protect your files. If you are working on network environment place all your files [red][b] but I am not sure about exe [/b][/red] in your directory that is not accessible for other users.
:
:
:
He does not want to change exe file. He wants to PROTECT it against CHANGES!!!
: : [red] The binary files are not protected against that. After you build/create the file you can set its property to readonly. That'll help a litle bit [/red]
:
:
: OK, I figured out how to do that. But can my program still read and write them?
:
: Also, would setting them to hidden do me any good?
:
:
:
:
Neither hidden nor readonly will do much good at all. Neither attribute actually protects a file unless the editing application checks first. In other words, if you set readonly and the app checks first then the edit will fail. If the app doesn't check first, the edit will save as normal.
A file does not have to have the readonly attribute turned off to edit it!
: This is espeicially for true CPU bound binary files that have been programmed without an multi-proces OS like Z80.
:
Interesting. I've made it sort of a practice to make some exes self-modifiable by adding changing data to the end of it. Never had a problem with it...