Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
When to use the different types of files.
#1
I was wanting to save my data when I realised that I din't know anything about the file types and their strengths and weakenesses. Could someone please help me?
Reply
#2
Basically, you save stuff in your own format, and file extensions don't matter.
am an asshole. Get used to it.
Reply
#3
Sory I didn't make my self clear. I was talking about when you open a file for output, binary, random etc.
Reply
#4
OUTPUT is just text, I don't really mess with it
BINARY will save data types. This what I use all the time
RANDOM is all over the place. You can access any part you want without having to rewrite all the content. I'm not really familiar with this type, either, so if I got that explanation wrong, don't shoot me.

I guess weaknesses of OUTPUT would be speed and having to parse your data, since it's just text. BINARY you have to remember which order you saved stuff when you load it, but it's not that hard.
am an asshole. Get used to it.
Reply
#5
I use OUTPUT and INPUT and LINE INPUT a$ and PRINT #1. Easy.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#6
I've only ever used OUTPUT and RANDOM, but I'll get around to learning about BINARY some time in the future

ps: I've modified GIF loaders that used binary, but that doesn't count, does it.
Reply
#7
the different OPENning modes that you're interested in. If you want to *write* stuff to a file and then be able to look at it with a text editor and understand what you're looking at, FOR OUTPUT or FOR APPEND might be a good idea. (FOR OUTPUT will cause an already existing file to get replaced. FOR APPEND will cause any data written to an already existing file to get written to the end of it, saving what was already there.) But you can't read *and* write with either of those modes.

If you want to *read* text data from a file, use FOR INPUT. However, you can't output (i.e., write) to a file opened with that mode.

If you want to read *and* write from the same file, use FOR BINARY or FOR RANDOM. The disadvantage there is that you can't generally look at such files with a text editor and see anything too intelligible. Other advantages are, however, that such files tend to be smaller than their text counterparts and they store the data more accurately. (They store the data mirroring the way it's stored in memory, before writing to the file.)
ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
Reply
#8
Okay thank you everyone for your help.
Reply
#9
RANDOM is crappy. You have to specify a fixed record length and then you can just grab a record with a record number instead of just using BINARY and multiplying by the length of your record structure... lazy bums Wink
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)