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 ;)

We try to help the people who post they code and what they have done to solve problem.

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);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.