Forum > Linux

[SOLVED] File Not Found by FPC Reset under WSL2 Ubuntu-20.04 on Windows 10

<< < (2/2)


--- Quote from: PascalDragon on February 14, 2024, 08:52:26 pm ---This is not necessary if the SysUtils is used as by default (unless $I- is used) an I/O error will be converted to an exception. See also here.

--- End quote ---
Thank you very much for the hint PascalDragon.

Yes, that is definitely true but I made my remark with OP's code in mind which seem to require some form of proper file error handling before actually attempting to process the file. Though dbannon's suggestion is perhaps more elegant it is (theoretically) still possible that something is amiss when attempting to open/access the file. The exception is nice to have (as a backup to know what is/went wrong).

I know you marked the issue as being solved but

--- Quote from: MisterD on February 14, 2024, 05:10:26 am ---Thank you Davo for your suggestion.
The spaces between the filename and message in Log 1 below made me realize that I
needed to pad infilename with trailing nulls instead of trailing spaces.

--- End quote ---
When you write padding with trailing nulls then something tells me that there might be something wrong somewhere in your parsing routine. Are you using hard-coded length strings (shortstrings) or something ?

And are you aware of the function trim that automatically strips non visible characters from a string  ?

As a hint: when you write out filenames (but I personally also use it for displaying any string data) try to enclose the output into quotes (e.g. quotedstr) so that you are able to visually inspect the outputted string in a more detailed manner.


[0] Message Index

[*] Previous page

Go to full version