fork download
  1. #include <iostream>
  2. #include <netinet/in.h>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. unsigned short port = 8080;
  8. unsigned short modified_port = htons(8080);
  9.  
  10. cout << modified_port << endl;
  11.  
  12. unsigned short back_to_port = ntohs(20480);
  13.  
  14. cout << back_to_port << endl;
  15.  
  16. return 0;
  17. }
Success #stdin #stdout 0s 5304KB
stdin
Standard input is empty
stdout
36895
80