Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / How do you copy and paste file to file using arrays?

Author
Message
Explosm69
15
Years of Service
User Offline
Joined: 22nd Jul 2010
Location:
Posted: 26th May 2012 23:28 Edited at: 26th May 2012 23:29
Hello, I'm trying to do a html template like in Dreamweaver, but when I copy the text from the template file using an array and make that array into a file, it comes out all screwed up.
The concept was that in the dba it would search for the key word: <!-- BeginUpdate /-->; copies everything between that key word and another which is: <!-- EndUpdate /-->; But unfortunately it gets cut off, although i think the spacing may have something to do with it, I was unable to figure it out.
The Original html file:

The Copied and Pasted File:


The dba file coding:


I'm Running Vanilla, no plugins if that helps a little...
Can anyone help my predicament?

Cyanide & Happiness 4 Ever
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 27th May 2012 04:11
Interesti.g

Dont mind me just tailing along for now...

Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 30th May 2012 22:35
@Explosm69
I knocked together together a simple method similar to your code. But if my goal was only to copy the file, I wouldn't use an intermittent array. I would read in the data/line, parse it, then write it out to a second file directly. However, if I needed to do further editing on the data before writing it to a new file, then using an array for temp storage would be more useful.

I took the approach of using an array. Also, the code isn't written to handle anomalies. By that I mean if the input file had non standard formatting, or there were extra spaces, or it wasn't left justified for the headers, my example code doesn't check for this. Also it doesn't check for nested update tags.

But I think this code generally does what you want:



Enjoy your day.

Login to post a reply

Server time is: 2026-07-08 03:48:44
Your offset time is: 2026-07-08 03:48:44