Problems with WriteString

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 30/01/2006 at 03:13, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   8.5 
Platform:   Windows  ;   
Language(s) :   C.O.F.F.E.E  ;  C++  ;

---------
Hello,
I am trying to write to a string to a BaseFile using WriteString() using the C++ API. When I open the file in a texteditor I see a lot of extra characters.

I tried doing the same thing with COFFEE and it works fine.
Any suggestions?

Regards
/Filip

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 30/01/2006 at 07:09, xxxxxxxx wrote:

WriteString() writes a C4D C++ String to file (which contains the string length and is usually Unicode encoded). The files that BaseFile writes are basically binary. If you want to write ASCII, best to use either WriteBytes() or WriteChar().

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 31/01/2006 at 03:08, xxxxxxxx wrote:

OK, thanks. So what I have done now is to write my own string-writing function that takes a string and writes it to a file one charater at a time using WriteChar(). This works fine, but is there a more efficient way of doing this?

My plugin will be writing a lot of text to a file, so the faster the better!

regards
/Filip

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 31/01/2006 at 03:57, xxxxxxxx wrote:

hi,

i had yesterday the same problem... i solved it like you with an own writestring function...

but i did something like this...
i got from the String class via GetCString a c-string...
and used WriteBytes from the file class...

ultra

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 31/01/2006 at 09:43, xxxxxxxx wrote:

Yes, exactly as ultra says is the best approach. :)

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 01/02/2006 at 03:35, xxxxxxxx wrote:

OK, thank you for the help!
/Filip