fork download
  1. #include <iostream>
  2. #include <cstring>
  3.  
  4. struct Packet {
  5. unsigned int packet_type;
  6. wchar_t packet_length[128];
  7. wchar_t file_name[256];
  8. wchar_t template_name[256];
  9. wchar_t file_name_list[1024];
  10. wchar_t file_data[1024];
  11.  
  12. void serialize(char * dat) {
  13. memcpy(dat, this, sizeof(Packet));
  14. }
  15.  
  16. void deserialize(const char * dat) {
  17. memcpy(this, dat, sizeof(Packet));
  18. }
  19. };
  20.  
  21. using namespace std;
  22.  
  23. int main(void) {
  24. cout << sizeof(wchar_t) << endl;
  25. cout << sizeof(Packet) << endl;
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
4
10756