[Gambas-user] Write to file is adding strange characters

Benoit Minisini gambas at ...1...
Wed Dec 26 20:32:28 CET 2007


On mardi 25 décembre 2007, lawrence pires wrote:
> Im trying to automate the writing of a dvd.xml file.
>
> Im trying to create and write the following text into a file:
>
>  <dvdauthor>  <vmgm />    <titleset>      <titles>        <pgc>
>   <vob file="your_video.mpg" chapters="0,0:20,0:30,0:40,0:50,0:60" />
>       </pgc>      </titles>    </titleset></dvdauthor>
>
>
> Heres the code im using:
>
> PUBLIC SUB Button2_Click()
> DIM hFile AS File
> DIM test AS String
> DIM test1 AS String
> DIM test3 AS String
>
> test = "<dvdauthor> \n<vmgm /> \n<titleset>\n<titles>\n<pgc>\n"
> test1 = "<vob" "file=\"your_video.mpg\""
> "chapters=\"0,0:20,0:30,0:40,0:50,0:60\"" "/>"
> test3 = "\n</pgc>\n</titles>\n</titleset>\n</dvdauthor>"
>
> hFile = OPEN "/home/don/Desktop/dvd" FOR CREATE
>
> WRITE #hFile, test
> WRITE #hFile, test1
> WRITE #hFile, test3
> FLUSH #hFile
> CLOSE #hFile
> END
>
> And this is the contents after the above has been executed:
>
> 1<dvdauthor>
> <vmgm />
> <titleset>
> <titles>
> <pgc>
> @<vobfile="your_video.mpg"chapters="0,0:20,0:30,0:40,0:50,0:60"/>*
> </pgc>
> </titles>
> </titleset>
> </dvdauthor>
>
>
> As you can see is writing strange characters to the dvd.xml file.
>
>
> can anyone please help me?
>
> Kind regards & Happy Christmas

WRITE is for writing binary data. Use PRINT to write text data.

Regards,

-- 
Benoit Minisini




More information about the User mailing list