Hello qbasic fans. First time poster, long time qbasic fan. I was wondering how to access a binary file in qbasic. I know how to with a text file, but the project I am doing needs me to access a binary file.
I know it probably sound like a lame question, but I'm stumped.
Binary Files
Binary Files
SYNTAX ERROR ...
- Codemss
- Veteran
- Posts: 124
- Joined: Sun Jun 24, 2007 6:49 am
- Location: Utrecht, The Netherlands
- Contact:
I believe you can do this with:
OPEN file$ FOR BINARY AS #1
CLOSE #1
But I don't know how to write to the file. Thought it was with POKE:
POKE p&, c
p& is the place where to poke c.
c is in the range of 0-255.
OPEN file$ FOR BINARY AS #1
CLOSE #1
But I don't know how to write to the file. Thought it was with POKE:
POKE p&, c
p& is the place where to poke c.
c is in the range of 0-255.
Check out my site: <a href="http://members.lycos.nl/rubynl">Click here</a>
Hope you like it. Send some feedback if you want: <a href="mailto:basicallybest@live.nl">Mail me</a>
Codemss, before known as RubyNL
Hope you like it. Send some feedback if you want: <a href="mailto:basicallybest@live.nl">Mail me</a>
Codemss, before known as RubyNL
-
- Veteran
- Posts: 703
- Joined: Sun Nov 14, 2004 7:36 am
- Contact:
Hi supernova,
I wrote a tutorial on binary file in this webste's e-zine. You can read it here: http://www.petesqbsite.com/sections/exp ... inaryfiles
How it helps, it teaches how to write and read binary files based on datatype and also with en example using user defined types.
Hope it helps.
I wrote a tutorial on binary file in this webste's e-zine. You can read it here: http://www.petesqbsite.com/sections/exp ... inaryfiles
How it helps, it teaches how to write and read binary files based on datatype and also with en example using user defined types.
Hope it helps.
When God created light, so too was born, the first Shadow!
MystikShadows
Need hosting? http://www.jc-hosting.net
Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com
MystikShadows
Need hosting? http://www.jc-hosting.net
Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com
Re: Binary Files
[quote="supernova"]access a binary file in qbasic[/quote]Sounds funny, but it is really necessary to know WHY you need to "access a binary file". Otherwise, the only answer is a general tutorial on file access including OPEN FOR RANDOM and OPEN FOR BINARY, blah-blah-blah.
What do you want to accomplish? Why?
Example: I have an EXE which has a comment that says "Do Not Copy". I want to change it to "O.K. to Copy". (or whatever it is that you are trying to accomplish).
If the answer is "nothing in particular - just wondering" then hop on MystikShadows's tutorial.
Mac
What do you want to accomplish? Why?
Example: I have an EXE which has a comment that says "Do Not Copy". I want to change it to "O.K. to Copy". (or whatever it is that you are trying to accomplish).
If the answer is "nothing in particular - just wondering" then hop on MystikShadows's tutorial.
Mac