0

Hi, need help with this. I have a text file with info in that format:

product1
description stock
product2
description stock

And want to save that values to a record like this:

prod=record
                name:string;
                des:string;                
                sto:integer;
           end;

forget the "assign" and "reset" part, I got this, I actually need help with the read and write process.

I mean, how to read a line, store the value, and go to the new line that have two space separated values to read!!!


Thanks and Sorry for my english ;)

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by dobleseis
1

Yep. My fault..

BTW, it's solved!

assign(logicalfile,'phisicalfile.txt');
reset(logicalfile);
rewrite(prodfile);
repeat begin
    readln(logicalfile,rec.name);
    readln(logicalfile,rec.des,rec.sto);
    writeln(ProdFile,rec);
end;
until(eof(logicalfile));
close(prodfile);
close(logicalfile);
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.