Need help creating arrays. :(

[b][red]This message was edited by gomes. at 2007-2-10 8:28:20[/red][/b][hr]
Okay basically there is this program below (see 2 pics). On the second picture, I have drew a black box around to indicate the part I am talking about. So basically the program in the blackbox, is to read arrays from a text file. [b]Instead of reading those data, I would like to know how to write (as in the enter data in the program) those data using arrays into a text OR binary file[/b]

cheers!

http://img185.imageshack.us/img185/8100/scan1wz0.jpg
http://img405.imageshack.us/img405/9066/scan2pd2.jpg


Comments

  • : [b][red]This message was edited by gomes. at 2007-2-10 8:28:20[/red][/b][hr]
    : Okay basically there is this program below (see 2 pics). On the second picture, I have drew a black box around to indicate the part I am talking about. So basically the program in the blackbox, is to read arrays from a text file. [b]Instead of reading those data, I would like to know how to write (as in the enter data in the program) those data using arrays into a text OR binary file[/b]
    :
    : cheers!
    :
    : http://img185.imageshack.us/img185/8100/scan1wz0.jpg
    : http://img405.imageshack.us/img405/9066/scan2pd2.jpg
    :

    Instead of "Reset(ScoresFile);" you would use "Rewrite(ScoresFile);"
    Note that this will destroy ALL data in the file and only new data written will exist.
    Then instead of using "ReadLn(ScoresFile, ...)" you would use "WriteLn(ScoresFile, ...)"

    If you want to write binary files, declare ScoresFile as a FILE, not a TEXT variable.
    Then you create the file almost the same way, except:
    "Rewrite(ScoresFile,1);"

    This tells it each record is 1 byte long (so you can just write whatever to the bonary file)
    and for the actual writes, it is now:
    "BlockWrite(ScoresFile, ..., SizeOf(...));"

    That's it!

    Phat Nat
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion