robby@nuchat.sccsi.com (Robert Oliver Jr.) (05/14/91)
Hi there,
Can some one out there tell me what is the problem????? With this code:
The Enviorment is Turbo Pascal 6.0 on a 286 with a 287:
[===cut=========================cut==========================cut==============]
Program air1;
uses crt,dos;
type doarray=array[1..80] of char;
lines=array[1..80] of string;
stats=record
name:string;
r1:integer;
cruise:integer;
r2:integer;
ceiling:integer;
r3:integer;
to50:integer;
r4:integer;
lo50:integer;
r5:integer;
payload:integer;
r6:integer;
range:integer;
t1:integer;
end;
var q:integer;
data:array[1..100] of stats;
f:text;
info:string;
done:boolean;
numlines:lines;
letter:char;
crap:string;
procedure getlines;
var i:integer;
crap:string;
begin
reset(f);
i:=0;
while not seekeof(f) do begin
i:=i+1;
repeat
read(f,crap);
until seekeoln(f);
readln(f,crap);
end;
q:=i;
writeln('q is : ',q);
writeln;
delay(1500);
end;
procedure readinfo(d:string);
var h,i,ii,dd,s:integer;
indata:string;
count:integer;
begin
count:=1;
i:=1;
clrscr;
assign(f,d);
getlines;
reset(f);
while not eof(f) do
begin
readln(f,indata);
if count=1 then reset(f);
while not eoln(f) do
begin
read(f,letter);
if (count=1) then begin
repeat
data[i].name:=data[i].name+letter;
read(f,letter);
until (letter=',');
count:=count+1;
end;
read(f,letter);
if (count=2) then begin
repeat
read(f,h); <-----------------------------what is the
data[i].cruise:=data[i].cruise+(h); <----PROBLEM????
until (letter=',');
count:=count+1;
end;
read(f,letter);
if (count=3) then begin
repeat
read(f,h); <----------------------------same as above
data[i].ceiling:=data[i].ceiling{+(h);}
until (letter=',');
count:=count+1;
end;
read(f,letter);
if (count=4) then begin
repeat
read(f,h); <---------------------------same as ^^^^^
data[i].to50:=data[i].to50{+(h);}
until (letter=',');
count:=count+1;
end;
read(f,letter);
if (count=5) then begin
repeat
read(f,h); <-------------------------same as ^^^^^^^^^
data[i].lo50:=data[i].lo50{+(h);}
until (letter=',');
count:=count+1;
end;
read(f,letter);
if (count=6) then begin
repeat
read(f,h); <------------------------------same as ^^^^^^^^
data[i].payload:=data[i].payload{+(h);}
until (letter=',');
count:=count+1;
end;
read(f,letter);
if (count=7) then begin
repeat
read(f,h); <-----------------------------same as ^^^^^^^^
data[i].range:=data[i].range{+(h);} <----last problem!!!!!
until (letter=',');
count:=count+1;
end;
writeln(data[i].name);
writeln(data[i].cruise);
end;
i:=i+1;
end;
end;
begin
readinfo('TEST.DAT');
close(f);
end.
[===========cut=====================cut=============================cut========]
TEST.DAT file
[==================================cut=====================================]
tfddsffdfdsfdfest,123,14200,2321,2312,546,321
test1,343,34234,2312,2342,342,543
t5dsfsdsd3,432,34232,3421,2134,352,643
[===================================cut====================================]
Thanks,
Robert Oliver
robby@nuchat.sccsi.com