Page 1 of 1

Deleteing Multible Lines Of A URL (File)

Posted: Mon May 07, 2018 7:25 am
by Googie85
Hi Guys,

I know this is a simple question but I am unable to find an answer to it. My line of code is below:

Code: Select all

 replace line 3 to line 4 of URL ("binfile:/mnt/sdcard/Temp.van") with ""
Any Help?

Many Thanks,

Googie.

Re: Deleteing Multible Lines Of A URL (File)

Posted: Mon May 07, 2018 9:12 am
by SparkOut
How would you determine what constitutes a "line" of binary data?
Is it possible to use a text file for which there are designated line endings? Or else, you will have to define markers in the binary data to be able to manipulate the sections you want (even if that is just counting the bytes).
Also try the syntax:

Code: Select all

put empty into line 3 to 4 of url ("file:" & theFilePath)
this assumes you are not using a binary file without "lines"

Re: Deleteing Multible Lines Of A URL (File)

Posted: Mon May 07, 2018 9:20 am
by FourthWorld
That statement reads a file from disk, gets a segment of it, and then does nothing.

If you want to change the file on disk you'll need to write to it too.

Re: Deleteing Multible Lines Of A URL (File)

Posted: Mon May 07, 2018 8:23 pm
by jacque
FourthWorld wrote:
Mon May 07, 2018 9:20 am
That statement reads a file from disk, gets a segment of it, and then does nothing.

If you want to change the file on disk you'll need to write to it too.
Not sure which statement you mean, but this one does the whole job:

Code: Select all

put empty into line 3 to 4 of url ("file:" & theFilePath)
URLs act as containers, so the read/write sequence completes.

Re: Deleteing Multible Lines Of A URL (File)

Posted: Mon May 07, 2018 8:29 pm
by FourthWorld
jacque wrote:
Mon May 07, 2018 8:23 pm
FourthWorld wrote:
Mon May 07, 2018 9:20 am
That statement reads a file from disk, gets a segment of it, and then does nothing.

If you want to change the file on disk you'll need to write to it too.
Not sure which statement you mean, but this one does the whole job:

Code: Select all

put empty into line 3 to 4 of url ("file:" & theFilePath)
URLs act as containers, so the read/write sequence completes.
Thanks. In retrospect, I can see I was distracted by a related question elsewhere.

Then what was the issue here?

Re: Deleteing Multible Lines Of A URL (File)

Posted: Mon May 07, 2018 9:32 pm
by jacque
Then what was the issue here?
I'm not quite sure, the actual problem wasn't defined. The issue of line endings is relevant, as well as alternate syntax for emptying lines, but it isn't clear what exactly went wrong in the original post.

Re: Deleteing Multible Lines Of A URL (File)

Posted: Tue May 08, 2018 12:47 am
by bwmilby
If you are on a Mac, you may get unintended effects using file. LC still thinks we are using legacy Macs with CR line endings. I write everything using binfile to avoid that issue. Using file will leave you with CR line endings. Using binfile will leave you with LF line endings.