Created
April 15, 2014 22:05
-
-
Save pnegri/10781677 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//oo FString | |
std::ostream& operator<<( std::ostream & s, FString& c ) | |
{ | |
uint16 fstringLength = c.Len(); | |
s.write( reinterpret_cast<const char*>(&fstringLength), sizeof(fstringLength) ); | |
return s; | |
} | |
std::istream& operator>>( std::istream & s, FString& c ) | |
{ | |
//s.read( reinterpret_cast<char*>(&c), sizeof(c) ); | |
uint16 fstringLength = 0; | |
s.read( reinterpret_cast<char *>(&fstringLength), sizeof(fstringLength) ); | |
static char buffer[65535]; | |
memset( buffer, 0, 65535); | |
if (s.good()) | |
{ | |
//s.read( reinterpret_cast<char *>(&buffer), sizeof(char)*(unsigned short)str_len ); | |
//_value.assign(buffer, str_len); | |
} | |
return s; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Way to use: | |
omsg << packet_id; | |
// Works | |
omsg << packet_id << name; | |
// Getting invalid operands to binary expression basic_ostream<char, std::__1:char_traits<char> > and FString |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//oo uint8 | |
std::ostream& operator<<( std::ostream & s, uint8& c ) | |
{ | |
s.write( reinterpret_cast<const char*>(&c), sizeof(c) ); | |
return s; | |
} | |
std::istream& operator>>( std::istream & s, uint8& c ) | |
{ | |
s.read( reinterpret_cast<char*>(&c), sizeof(c) ); | |
return s; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment