View Single Post
Old 06-26-2019, 06:59 AM   #25
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,143
Default

Quote:
Originally Posted by X-Raym View Post
As I'm not sure file_string actually return this character, it seems to check file line after line (so stripping new line character).
Anyway, it works on windows like that, so if it works on mac too, it will be a valid solution
Are you sure? Because here "\r\n" or "\n" are not stripped. Note that simply doing gfx_drawstr() will mask the issue, but if you replace it with this then you will probably see what I mean:

Code:
gfx_drawchar('<');
gfx_drawstr(map[slider2]);
gfx_drawchar('>');
Quote:
Originally Posted by X-Raym View Post
Have you tried it on Mac ?
I just did, and it seems to work the same as on Windows, i.e. it also doesn't strip (or convert) "\r\n" or "\n". But at least it does work consistent across Windows and macOS (and probably also Linux).

--

I think you are right about file_string() and file_avail(), so maybe this would make more sense then:

Code:
while(file_avail(handle)) (
  file_string(handle, #line);
  ...
);
Tale is offline   Reply With Quote