확인은 PWD에 존재합니다. Mac OS X
, objective-C
기반은 시스템 호출과 함께 작동해야합니다.
여기 내 샘플 프로그램은 popen
을 사용하고 있습니다. (내 코드의 일부분 .. 완료되지 않음)
char unix_script[1000];
memset(unix_script,'\0',sizeof(unix_script));
snprintf(unix_script,
sizeof(unix_script),
"ksh /usr/mahesh/sessioN.ksh %s %s %s %s %s",
userId,
password,
database,
sbcr_id,
session_id);
char *COMMAND = unix_script,*readLine, *tmp, *commandResult = "";
FILE * fp;
int status;
fp = popen(COMMAND, "w");
if (fp == NULL) {
perror("Command execution failed");
exit(1);
}
//printf("Printing the command output....");
while ((fscanf(fp, "%s", &readLine)) != EOF) {
tmp = (char *) realloc(commandResult, strlen(readLine));
commandResult = tmp;
strcpy(commandResult, readLine);
}
printf("\n output =\n %s\n",commandResult);
status = pclose(fp);
//printf ("Command %s exit status code = %d\n", COMMAND, status);
return status;
"it"? 뭐가 잘못 됐나? BS,'system()'도 C89 표준에 속합니다. –
유효하지 않습니까? 실제 오류 메시지가 무엇입니까? 'stdlib.h '를 포함 시켰습니까? – FatalError
"it"은 xcode를 의미하며, 그렇습니다. stdlib.h를 포함 시켰습니다. –