Hi, I am a beginner at programing and I only have a little knowledge of turbo pascal. I read the tutorial lessons on http://www.learn-programming.za.net but I have a problem when try to make a working application.

I am working on some program that would found variables value in the equation that can't be calculate using algebra.

But my appliction will need about 120 variables that need values imput. So I would like to put values in the excel sheet and than transffer to txt file. Individual values will be separate by the "," or some other sign.

So here goes my question.
How can I import value in pascal from txt file? I found these pice of code, but the problem is that I do not know how to read from a defined place in txt file (example; 3rd column, 5th line).

The Read command is used to read from a data file.
program DataFiles;

var
f: file of Byte;
b: Byte;

begin
Assign(f,'MyFile.txt');
Reset(f);
Seek(f,0);
Read(f,b);
end.

the txt file transfered from excel will look something like that;
1324,32435,547658,345346,4575678,34636
346,3465756,45637,54745756,658568568,568568
4564,657,546,34,453536,767567
346456,657567,657245,43557,89078,546768
658,5464,6589,36456,5678568,54747
547567,768346,345567,34563,65,45

so we have 6 columns, and 6 lines. Data are separate with ",". Now we woul like to read 3rd column, 5th line (6589) and so on....

Recommended Answers

All 3 Replies

while not eof(f) do
begin
read(f,b);//here you can store all your values in some array
end;

while not eof(f) do
begin
read(f,b);//here you can store all your values in some array
end;

that is nothing!

in this case, i will wait for you to give us the best solution, because i believe that you're an programming guru, and i'm sorry that we aren't on the high of your expectations

best regards,

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.