123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|544|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> C/C++/C#/Other -> Saving wchar_t* to file?!

Thu, 11 Feb 2010, 02:41
Afr0
Trying to save a string to a file in C++ through UDK...



This code produces the string '10396BE0' in the save file from the string 'TestLevel'.

Doing



produces the string '84'. Is this the address of the pointer?! I thought derefencing the pointer would retrieve the value stored at the address??

Edit: Yes, the parameters have to be wchar_t*s, because that's what UDK accepts as strings...

-=-=-
Afr0 Games

Project Dollhouse on Github - Please fork!
Thu, 11 Feb 2010, 03:15
Sticky
I wrote some binary input\output stuff in C++ the other day. This may help, but I'm not too sure about using C or UDK.




Of course, in the actual code I'm reading and writing structs with two uint32_t's, a std::string and a uint8_t.

This is also all using this code below, which isn't quite the way you're doing it.



-=-=-
last.fm
Thu, 11 Feb 2010, 03:16
Afr0
What's fFile?

Is it an ofstream instance?
Thu, 11 Feb 2010, 03:24
Sticky
Haha, just updated my post as you made your own.



-=-=-
last.fm
Thu, 11 Feb 2010, 03:50
Afr0
I found the solution!

I needed to declare a wofstream instead of an ofstream.

-=-=-
Afr0 Games

Project Dollhouse on Github - Please fork!