Please help
Look at this data and then look at the program bellow
This program should take this data from a file ( bc-tags.txt )
Bostom MA,032,CDN NHD NO BC,West Orange NJ1,1029875243,////,
45555(hfgt)#653
Bostom MB,032,2CDN NHD NO BC,West Orange NJ2,1029875243,////,
455(hfgt)#653
Bostom MC,032,33CDN NHD NO BC,West Orange NJ3,10293875243,////,
5455(hfgt)#653
Bostom MD,032,44CDN NHD NO BC,West Orange NJ4,1029875243,////,
455(hfgt)#653
And convert it to this output file as follows( bc-tags.out )( cut the
last two fields)
Bostom MA,032,CDN NHD NO BC,West Orange NJ1,1029875243
Bostom MB,032,2CDN NHD NO BC,West Orange NJ2,1029875243
Bostom MC,032,33CDN NHD NO BC,West Orange NJ3,10293875243
Bostom MD,032,44CDN NHD NO BC,West Orange NJ4,1029875243
But instead, I am getting this( it is ignoring the SPACES )
BostomMA,032,CDNNHDNOBC,WestOrangeNJ1,1029875243
BostomMB,032,2CDNNHDNOBC,WestOrangeNJ2,1029875243
BostomMC,032,33CDNNHDNOBC,WestOrangeNJ3,10293875243
BostomMD,032,44CDNNHDNOBC,WestOrangeNJ4,1029875243
Please help me to figure out why the SPACES don't show on the result
output file.
This is the program, TURBO PASCAL 6.0
uses crt;
var
inputfile: text;
outputfile: text;
ch: char;
counter,totaltags: integer;
begin
clrscr;
totaltags:=0;
writeln('The INPUT file name is BC-TAGS.TXT');
writeln('The OUTPUT file is BC-TAGS.OUT');
Assign(inputfile, 'bc-tags.txt');
reset(inputfile);
Assign(outputfile, 'bc-tags.out');
rewrite(outputfile);
while not seekeof(inputfile) do
begin
writeln;
counter:=0;
totaltags:=totaltags+1;
while not seekeoln(inputfile) do
begin
Read(inputfile,ch);
if ch = ',' then counter := counter+1;
if counter < 5 then
begin
write(outputfile,ch);
write(ch);
end
else
end;
writeln(outputfile);
end;
close(inputfile);
writeln;
writeln;
writeln;
writeln('The proccess was complited');
writeln;
writeln;
writeln('Hit ENTER to exit');
readln;
end.
Please reply to this e-mail ji...@nycmetro.com
Thanks Doney