Notifications
Clear all

[Closed] Convert a DAE file from ascii to binary

I’m trying to read and ascii dae file and convert it to a binary file. I’m having some issues with the binary portion of it. At least as far as I know that’s where the issues are. Could use some help on what I’m doing wrong.

–get ascii file
oldFile = openFile “C:\ est.DAE”
–put it in a string
seek oldFile #eof
maxlen=filepos oldFile
seek oldFile 0
res = readChars oldFile maxlen errorAtEOF:false
–create a new file
newFile = createFile “C:\ est_optimized.DAE”
–write the string to binary file
f=fopen “C:\ est_optimized.DAE” “wb”
WriteString f res
–close the file
fclose f
close newFile

–read the file
look=fopen “C:\ est_optimized.DAE” “rb”
ReadString look
fclose look

1 Reply

This works in that it creates a new file and loads the string in the file. So its essentially just a renamed copy of the original. I need to parse the ascii string and convert it to binary before writing it to the file.

–get ascii file
oldFile = openFile “C:\ est.DAE”
–put it in a string
seek oldFile #eof
maxlen=filepos oldFile
seek oldFile 0
res = readChars oldFile maxlen errorAtEOF:false

f=fopen “C:\ est_op.DAE” “wb”
WriteString f res
fclose f

f=fopen “C:\ est_op.DAE” “rb”
ReadString f
fclose f