just playing around with winsock and trying to set up a remote shell for my windows box and having a little trouble with the fwrite and fread it would appearCode:char psBuffer[128]; FILE *pPipe; pPipe = _popen("cmd", "rw"); while (!feof(pPipe) && !ferror(pPipe)) { char* command=readLine(client); fwrite(command,sizeof(char),((string)psBuffer).length(),pPipe); fread(psBuffer, sizeof(char), ((string)psBuffer).length(), pPipe);//waits here :| send(client,psBuffer,strlen(psBuffer),0); }
any ideas as to why my fread causes the program to just stall and wait? is fflush the answer(didnt look like it when i tried)?
anyways the general idea is user sends command which program sends off to cmd.exe which then displays the output back to the user...
thank you for your time![]()



LinkBack URL
About LinkBacks



