I have this code that returns the bytes in a file, except it will only give
the byte count for a file that is in the same folder as the executable.
procedure TForm1.FileBytes(FileNm : string);
var f : textfile; ttlBytes, AHandle : integer;
begin
//get bytes in file
AHandle := FileOpen(PChar(FileNm), fmShareDenyNone);
ttlBytes := GetFileSize(AHandle, nil);
FileClose(AHandle);
ShowMessage(inttostr(ttlBytes));
Executing like this: FileBytes('C:\folder\file.txt'); give a file size of -1.
Anyone know of a way to get it to work with the path included?
Thanks