我在 fp=fopen("task.txt","r")
处收到错误,有人可以帮我吗?
我正在尝试使用 fp(文件指针)
main()
{
int l=0,pr[100];
FILE *fp;
fp=("task.txt","r");
if(fp==NULL)
printf("No file found");
char arr[100][20];
const char *str;int i;
while(fscanf(fp,"%s",str)!=EOF)
{
strcpy(arr[l],str);
l++;
}
for(i=0;i<l;i++)
{
system(arr[i]);
}
}
最佳答案
你的代码没有这样的行。再次检查您的代码。
你写的时候没有使用 fopen
fp=("task.txt","r");
写这个
fp=fopen("task.txt","r");
你会得到它
关于c - 获取 "warning:assignment from incompatible pointer type",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43493140/