0
我有這個程序,我的目標是在Linux中查找文本文件程序,但它發現所有文件,如*.*
。 你能幫我找到代碼問題嗎?在Ubuntu目錄中查找文本文件
#include<stdio.h>
#include<stdlib.h>
int main()
{
char str[256], str2[256], buf[256];
strcpy(str,"find -name ");
strcpy(str2,"'*.txt'");
sprintf(buf, "/bin/sh -c %s %s", str,str2);
system(buf);
return 0;
}