Here is my code
#include <iostream>
#include <cstdio>
#include <string>
#include <fstream>
using namespace std;
int main(int argc,char *argv[]){
FILE* pipe=popen("ls","r");
string total;
char c;
cout<<"initialized"<<endl;
while(!feof(pipe)){
total+=fgetc(pipe);
}
fclose(pipe);
cout<<total<<endl;
return 0;
}
that code works, however, I am not trying to work with ls. I am
trying to work with "top" when I replace ls with top, the program
refuses to work
this is on a mac
thanx for any help
-Erik
|