Deleteing Multible Lines Of A URL (File)

The place to discuss anything and everything about running your LiveCode on Android

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
Googie85
Posts: 105
Joined: Tue Aug 05, 2014 10:07 am

Deleteing Multible Lines Of A URL (File)

Post by Googie85 » Mon May 07, 2018 7:25 am

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.

SparkOut
Posts: 1802
Joined: Sun Sep 23, 2007 4:58 pm

Re: Deleteing Multible Lines Of A URL (File)

Post by SparkOut » Mon May 07, 2018 9:12 am

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"

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6173
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Deleteing Multible Lines Of A URL (File)

Post by FourthWorld » 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.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4658
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Deleteing Multible Lines Of A URL (File)

Post by jacque » 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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6173
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Deleteing Multible Lines Of A URL (File)

Post by FourthWorld » Mon May 07, 2018 8:29 pm

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?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4658
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Deleteing Multible Lines Of A URL (File)

Post by jacque » Mon May 07, 2018 9:32 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

bwmilby
Posts: 212
Joined: Wed Jun 07, 2017 5:37 am
Location: New Orleans, LA
Contact:

Re: Deleteing Multible Lines Of A URL (File)

Post by bwmilby » Tue May 08, 2018 12:47 am

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.
Brian Milby

Script Tracker https://github.com/bwmilby/lc-misc/tree/master/ScriptTracker

Post Reply

Return to “Android Deployment”