fork(2) download
  1. #include <string>
  2. #include <iostream>
  3.  
  4. // .h
  5. class MainClass {
  6. public:
  7. static const unsigned char predefinedArray1[3];
  8. static const unsigned char predefinedArray2[5];
  9. };
  10.  
  11. // .cpp
  12. const unsigned char MainClass::predefinedArray1[] = { 'x', 'y', 'z' };
  13. const unsigned char MainClass::predefinedArray2[] = { 'a', 'b', 'c', 'd', 'e' };
  14.  
  15.  
  16.  
  17. // SendData -- Imitating transmission...
  18. bool SendData(const unsigned char* data, size_t size){
  19. std::cout << "Sending Data (" << size << " bytes): ";
  20. for (size_t i = 0; i < size; ++i)
  21. std::cout << data[i];
  22. std::cout << std::endl;
  23. return true;
  24. }
  25.  
  26.  
  27. int main() {
  28. SendData(MainClass::predefinedArray1,
  29. sizeof(MainClass::predefinedArray1)/sizeof(*MainClass::predefinedArray1));
  30. SendData(MainClass::predefinedArray2,
  31. sizeof(MainClass::predefinedArray2)/sizeof(*MainClass::predefinedArray2));
  32.  
  33. return 0;
  34. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
Sending Data (3 bytes): xyz
Sending Data (5 bytes): abcde