Good morning. Hello,
I'm looking to get the preview of Windows files.
To do this inside the file, I found the text to recover. It's start by "PNG" and ended by "IEND".
So I open the file with "open" I read it with "read" and close it with "close". I put "it" in a variable. I search for PNG and IEND and remove what is before and after. And I recreate a PNG file with this content. The concern is that when I put this in a variable, Livecode doesn't differentiate between "CRLF","LF" and "CR" at the end of the line. He puts it all in "CRLF". And as with every line, it's never the same, sometime "CR" and sometime "LF". It is almost impossible for me to change it automatically.
I also tried another approach. A full copy of the file with "revCopyFile", but in this case I can't delete the text before and after.
I'm in a dead end.
Do you have an idea or a solution to get me out of here?
Is there another way to get the preview?
Is it possible to force livecode to keep the "LF" and "CR" in a variable?
How do I delete text in a file without using a variable?
Thank you in advance
Krynn
CRLF vs CR&LF
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
- Location: McKenna, WA
Re: CRLF vs CR&LF
Looks line your trying to open a binary file. Look up "binfile" in the dictionary and see if that helps.
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14
Re: CRLF vs CR&LF
The constants return, CR, and LF are all ASCII 10. The constant CRLF is ASCII 13 + ASCII 10. There is no constant for the carriage return character alone (ASCII 13).
When opening text files, LiveCode will convert everything to LF internally. On Windows, when writing a text file out it will convert the line separators to CRLF. On Mac it will use CR (ASCII 13) and on Linux it will use LF.
When opening text files, LiveCode will convert everything to LF internally. On Windows, when writing a text file out it will convert the line separators to CRLF. On Mac it will use CR (ASCII 13) and on Linux it will use LF.
Brian Milby
Script Tracker https://github.com/bwmilby/scriptTracker
Script Tracker https://github.com/bwmilby/scriptTracker
Re: CRLF vs CR&LF
I had also tried 2 or 3 things with binfile but I didn't succeed.quailcreek wrote: ↑Thu Dec 28, 2017 11:44 pmLooks line your trying to open a binary file. Look up "binfile" in the dictionary and see if that helps.
I insisted and in 3 lines of code, it works.
thank you
Krynn
for tips
Code: Select all
get URL "binfile:C:/path/namefile.xxx"
put it into lVariable
........
put lVariable into URL "binfile:C:/path/namefile.yyy"