//WECP100/hello.cpp 20240723
//decription: std out for c++ using system call on LINUX
//machine: WSL on window11
//os: cat /etc/os-release >> PRETTY_NAME="Ubuntu 22.04.2 LTS"
// uname -a >> linux LAPTOP-2E5CQCBT 5.15.153.1-microsoft-standard-WSL2
// >> Fri Mar 29 23:14:13 UTC 2024 x86_64 x86_64 x86_64 GNU/
//language: c++, g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
// g++ --version >> g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
//> wsl
//$ g++ hello.cpp -o hello
//$ ./hello
//$ result
// {"codeId":"WECP100hello"}
#include < stdio.h>
#include < stdlib.h>
#include < unistd.h>
#include < iostream>
int main() {
// 1 2345678 91 1234567892123 4 5
char buffer[]={"{\"codeId\":\"WECP100hello\"}\n"};
printf("%s",buffer); // stdio library
fprintf(stdout,"%s",buffer); // file:stdout
puts(buffer); // with \n
write(STDOUT_FILENO,buffer,26); // STDOUT_FILENO:1 , length
fputs(buffer, stdout); // file:stdout
//------------------------------------------
int i=0;
while(buffer[i]){ // until 00
putchar(buffer[i++]); // put one character
}
//------------------------------------------
std::cout << buffer; // c++ cout
//-----------------------------------------
}