|
정장혁 님이 쓰신 글 :
: VCL 로 프로그램을 만들다,stdio 함수인 _popen를 호출 했는데, 무조건 NULL값만 반환 하는 군요.
: 혹시 뭘 빼먹었는지 궁금합니다.
:
: void __fastcall TWebMonitorForm::BitBtn4Click(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)
: {
: ShowMessage("_popen error");
: }
:
: // read and display input received from the child process
: while (fgets(message, sizeof(message), handle))
: {
: ShowMessage( message);
: }
:
: // close the pipe and check the return status
: status = _pclose(handle);
: if (status == -1)
: {
: ShowMessage("_pclose error");
: }
:
:
: }
DLL로 만들어 써야 겠네요.
|