printf1 [LUA] 외부 application의 출력 내용(printf등)을 얻어오기 io.popen 1. 테스트를 위한 간단한 응용 프로그램 소스. (Console application) > 윈도우에서 VC++로 작성했으나, 리눅스 프로그램도 적용 가능합니다.#include "stdafx.h" int _tmain(int argc, _TCHAR* argv[]){printf("hello lua!!\n");return 0;} >> 출력 결과hello lua!! 2. lua 코드 (빨간색 부분이 실행할 파일의 경로) local f = io.popen("D:\\test1.exe", "r") if f thenlocal data = f:read("*all")f:close(); print ("result >> " .. data);end >> 출력 결과result >> hello lua!! >Exit code: 0 ※.. 2014. 1. 8. 이전 1 다음