Code:
void __fastcall TForm1::Button4Click(TObject *Sender)
{
FILE* handle; // handle to one end of pipe
char message[256]; // buffer for text passed through pipe
int status; // function return value
// open a pipe to receive text from a process running "DIR"
handle = _popen("dir /b", "rt");
if (handle == NULL)
{
perror("_popen error");
}
// read and display input received from the child process
while (fgets(message, sizeof(message), handle)) //<-- OVDE ZAKUCAVA!
{
fprintf(stdout, message);
}
// close the pipe and check the return status
status = _pclose(handle);
if (status == -1)
{
perror("_pclose error");
}
}
void __fastcall TForm1::Button4Click(TObject *Sender)
{
FILE* handle; // handle to one end of pipe
char message[256]; // buffer for text passed through pipe
int status; // function return value
// open a pipe to receive text from a process running "DIR"
handle = _popen("dir /b", "rt");
if (handle == NULL)
{
perror("_popen error");
}
// read and display input received from the child process
while (fgets(message, sizeof(message), handle)) //<-- OVDE ZAKUCAVA!
{
fprintf(stdout, message);
}
// close the pipe and check the return status
status = _pclose(handle);
if (status == -1)
{
perror("_pclose error");
}
}
Ovo je copy/paste primer iz BCB help-a, a debager pokazuje na liniju sa fgets?
Ag + Na -> Xe