|
From: Erik S. <esc...@gm...> - 2006-05-06 19:46:42
|
This code is for a mac
why does this not work?
#include <iostream>
#include <cstdio>
#include <fstream>
#include <string>
using namespace std;
int main(int argc,char *argv[]){
FILE* pipe=popen("top","top");
ifstream pipeStream(fileno(pipe));
string total;
char c;
while((pipeStream.get(c))!=NULL){
total+=c;
}
cout<<total<<endl;
pipeStream.close();
return 0;
}
|