Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Jan 12th, 2018 57 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #include <iostream>
  2. #include <cstdio>
  3.  
  4. using namespace std;
  5.  
  6. int main(int argc, char** argv) {
  7.  
  8.     char str[PATH_MAX]; //max string path
  9.  
  10.     FILE *rfile = popen("ls","r"); //read ls command
  11.     if(rfile == NULL) //if failed exit program
  12.         return 1;
  13.     while( fgets(str, PATH_MAX, rfile) != NULL){ //while not null print result
  14.         cout<<str;
  15.     }
  16.    
  17.     return (EXIT_SUCCESS);
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top