$text = readfile($inputfile);
?? Thx.
How to check whether readfile was successful?
-
autocart
- Posts: 1391
- Joined: 26 Sep 2013 15:22
How to check whether readfile was successful?
[AHK] redirecting Windows Explorer to XY, [XYS] Mini Tree with open tabs (cur loc expanded, tab folders highlighted), [AHK] customInlineRenameKeys, [AHK] clipboardHelper_and_XYEscToList
-
PeterH
- Posts: 2830
- Joined: 21 Nov 2005 20:39
- Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%
Re: How to check whether readfile was successful?
Not really exact - but test $text for "" 
-
autocart
- Posts: 1391
- Joined: 26 Sep 2013 15:22
Re: How to check whether readfile was successful?
if it was that simple I would not ask
i could think of contexts where $text might be "" before and if the file was empty then it might have the same result.
maybe i could check at the same time if property("size") == 0 but I am not sure if this is the case for all files who's readfile() results in "".
Of course, some errors (e.g. if the file is missing) result in a scripting error.
I don't know if all errors do that. (Because in this case this case would be closed.) Or if some silently return "" anyway.
If Don could enlighten us about that it would be nice, please, thx.
i could think of contexts where $text might be "" before and if the file was empty then it might have the same result.
maybe i could check at the same time if property("size") == 0 but I am not sure if this is the case for all files who's readfile() results in "".
Of course, some errors (e.g. if the file is missing) result in a scripting error.
I don't know if all errors do that. (Because in this case this case would be closed.) Or if some silently return "" anyway.
If Don could enlighten us about that it would be nice, please, thx.
[AHK] redirecting Windows Explorer to XY, [XYS] Mini Tree with open tabs (cur loc expanded, tab folders highlighted), [AHK] customInlineRenameKeys, [AHK] clipboardHelper_and_XYEscToList
-
admin
- Site Admin
- Posts: 66678
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: How to check whether readfile was successful?
It pops an error on failure.
FAQ | XY News RSS | XY X
-
autocart
- Posts: 1391
- Joined: 26 Sep 2013 15:22
Re: How to check whether readfile was successful?
ok, thx.admin wrote:It pops an error on failure.
[AHK] redirecting Windows Explorer to XY, [XYS] Mini Tree with open tabs (cur loc expanded, tab folders highlighted), [AHK] customInlineRenameKeys, [AHK] clipboardHelper_and_XYEscToList
XYplorer Beta Club