Page 1 of 1

Strings in textfiles

Posted: Tue May 05, 2020 12:02 pm
by TearsOfMe
Hello.
Can anyone tell me what i make wrong with this code.
I want to insert an string (a$,b$) in this file.

Code:
a$=files[0]
b$=files[1]

xml$="<dvdauthor>\n<vmgm />\n<titleset>\n<titles>\n<pgc>\n<vob file=\"..a$..\"/>\n<vob file=\"..b$..\"/>\n</pgc>\n</titles>\n</titleset>\n</dvdauthor>"
stringtofile (xml$, "dvd.xml")

Output:
<dvdauthor>
<vmgm />
<titleset>
<titles>
<pgc>
<vob file="a$"/>
<vob file="b$"/>
</pgc>
</titles>
</titleset>
</dvdauthor>


Greetz
Tears

Re: Strings in textfiles

Posted: Tue May 05, 2020 1:31 pm
by jPV
You'll have to close strings before doing concatenation. \" doesn't close them, but inserts a double quote in the string, so you'll have to add couple real double quotes there.

This should work:
xml$="<dvdauthor>\n<vmgm />\n<titleset>\n<titles>\n<pgc>\n<vob file=\""..a$.."\"/>\n<vob file=\""..b$.."\"/>\n</pgc>\n</titles>\n</titleset>\n</dvdauthor>"

Re: Strings in textfiles

Posted: Tue May 05, 2020 2:18 pm
by TearsOfMe
Perfect.
Thank you.