私はこの単純な C プログラムを書きましたが、strcat のこの奇妙な振る舞いを完全には理解できませんでした。
long sum(long col, char* path, char* path2){
printf("%s\n",path2);
strcat(path,".endlines");
printf("%s\n",path2);
return 0;
}
int main(int argc, char* argv[]) {
int n=atoi(argv[1]);
sum(n,argv[2],argv[3]);
exit(EXIT_SUCCESS);
}
strcat は path に適用されますが、最終的に path2 も変更されます。誰かが何が起こっているのか教えてくれたらとてもありがたいです:)ありがとう
走る
./program 3 example/mountdir/location2.csv example/rootdir/location2.csv
出力:
例/rootdir/location2.csv
エンドライン