online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <iostream> #include <cstdio> #include <iostream> #include <memory> #include <stdexcept> #include <string> #include <array> std::string exec(const char* cmd) { std::array<char, 128> buffer; std::string result; std::shared_ptr<FILE> pipe(popen(cmd, "r"), pclose); if (!pipe) throw std::runtime_error("popen() failed!"); while (!feof(pipe.get())) { if (fgets(, 128, pipe.get()) != nullptr) result +=; } return result; } using namespace std; int main() { cout<<"Start\n"; std::string res; res = exec("pwd"); std::cout << "1 res: " << res << std::endl; res = exec("echo stdout >&1"); std::cout << "2 res: " << res << std::endl; res = exec("echo stderr >&2"); std::cout << "3 res: " << res << std::endl; cout<<"End\n"; return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text



Program is not being debugged. Click "Debug" button to start program in debug mode.