ファイル名がコマンドラインから渡される小さなコードの下に、これがあります。このプログラムはexeclp()
別のプログラムから呼び出されています。system()
ここで呼び出されるコマンドの o/p がargv[2]
. それを行う方法の手がかりが得られません。
#include <stdio.h>
int main(int argc,char *argv[])
{
char c;
printf("Received : %s filename: %s\n",argv[1],argv[2]);
FILE *fp=fopen(argv[2],"w");
system("./linked_list");
printf("Here...\n");
sleep(5);
//sleep(3*atoi(argv[2]));
return 0;
}
./linked_list の o/p は、以下のように出力される単純なリストです。
****printing list****
info :0 address:0x884e068 next:0x884e0c8
info :1 address:0x884e0c8 next:0x884e058
info :2 address:0x884e058 next:0x884e0b8
info :3 address:0x884e0b8 next:0x884e048
info :4 address:0x884e048 next:0x884e0a8
info :5 address:0x884e0a8 next:0x884e038
info :6 address:0x884e038 next:0x884e098
info :7 address:0x884e098 next:0x884e028
info :8 address:0x884e028 next:0x884e088
info :9 address:0x884e088 next:0x884e018
info :10 address:0x884e018 next:0x884e078
info :11 address:0x884e078 next:0x884e008
Last element... info:12 address:0x884e008 next:(nil)
Child terminating...