Hi, All:

Previously, i made a program using d5. It works well in xp. But when i recently build it again in d7, many problems appear. Below is one of them.

When executing in d7, this chop file function prompts I/O 123 error? why ? Please help.

Thank you in advance.

*************

function Tform1.SplitFile(FileName : TFileName; SizeofFiles : Integer) : Boolean;
var
i : Word;
fs, sStream: TFileStream;
SplitFileName: String;
abc,a,ext,dir,path,newfile:string;
begin
fs := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite);
abc:=extractfilename(filename);
a:=extractfileext(abc);
dir:=stringreplace(abc,a,'',[rfReplaceAll, rfIgnoreCase]);
createdir(extractfiledir(filename)+'\'+dir);
path:=extractfiledir(filename)+'\'+dir+'\';
filelistbox2.Directory:=path;
try
panel43.visible:=true;
gauge54.minvalue:=0;
gauge54.maxvalue:=trunc(fs.Size / SizeofFiles)+1;
  for i := 1 to Trunc(fs.Size / SizeofFiles) + 1 do
  begin
    panel42.caption:='Chopping '+inttostr(i);
    gauge54.progress:=i;
    application.processmessages;
    SplitFileName := ChangeFileExt(FileName, '.'+ FormatFloat('000', i));
    newfile:= path+extractfilename(splitfilename);
    sStream := TFileStream.Create(newfile, fmCreate or fmShareExclusive);
    try
      if fs.Size - fs.Position < SizeofFiles then
        SizeofFiles := fs.Size - fs.Position;
      sStream.CopyFrom(fs, SizeofFiles);
    finally
      sStream.Free;
    end;
  end;
finally
  fs.Free;
end;
panel42.caption:='Chop Complete';
panel46.caption:='Save in: '+path;
panel43.visible:=false;
drivecombobox1.Update;
directorylistbox1.Update;
filelistbox2.Update;
filelistbox1.update;


end;

*******************

ipage,
the code does not prompt any error at all for my D7.

in pascal 123 error code meaning is the follows:
Too much symbol.The program or unit declares too much symbol.Try to divide for parts your code.Or try to compile your code with the $D-

in pascal 123 error code meaning is the follows:
Too much symbol.The program or unit declares too much symbol.Try to divide for parts your code.Or try to compile your code with the $D-

Thanks, FlamingClaw, but how to divide and how to do as you mentioned here by $D

yes,it is a compiler directive
main syntax,if i can say that :D

{$D-}
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.