바람처럼
홈
태그
미디어로그
위치로그
방명록
'_popen'에 해당되는 글 1건
2009.05.11
외부 프로세스를 호출 후 반환값 받아오기
외부 프로세스를 호출 후 반환값 받아오기
프로그래밍
2009. 5. 11. 02:30
msdn 예제를 그대로 옮긴다.
// crt_popen.c /* This program uses _popen and _pclose to receive a * stream of text from a system process. */ #include <stdio.h> #include <stdlib.h> int main( void ) { 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( "dir *.c /on /p", "rt" )) == NULL ) exit( 1 ); /* Read pipe until end of file, or an error occurs. */ while(fgets(psBuffer, 128, pPipe)) { printf(psBuffer); } /* Close pipe and print return value of pPipe. */ if (feof( pPipe)) { printf( "\nProcess returned %d\n", _pclose( pPipe ) ); } else { printf( "Error: Failed to read the pipe to the end.\n"); } }
공유하기
게시글 관리
바람처럼
저작자표시
비영리
Posted by
개발자캠퍼
1
open
close
개발자캠퍼
Article Category
분류 전체보기
(43)
프로그래밍
(28)
생활
(1)
기타
(0)
여행과 캠핑
(5)
C# 프로그래밍
(3)
Tag Cloud
odac
엑세스
Trac
PVK
IDE색상
enable32BitAppOnWin64
응용프로그램 서버 오류
MDB
어셈블리 로드 에러
DDL
adodb
LocalLow
ApplicationData
들여쓰기
편집기색상
pfx
administrator account
_popen
c++
popen
Recent Article
Recent Comment
Notice
Archive
Calendar
«
2025/02
»
일
월
화
수
목
금
토
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
My Link
testcode
볼랜드 포럼
데브피아
cppbuilder 완전정복
IBM developer works
All of Software
리버스 엔지니어링
Trac On Windows
고절가주팁
티스토리툴바