![]() |
幫我看看我寫ㄉC哪裡錯ㄌ
#include<stdio.h>
void main(void) { int i; char a[74]; FILE *aa; FILE *qq; aa=fopen("my dir.txt","r"); qq=fopen("out.txt","w"); for(i=1;i<=73;i++) { fgets(a[i],73,aa); fputs(a[i],qq); } } 12 C:\1.cpp passing `char' to argument 1 of `fgets(char *, int, FILE *)' lacks a cast 13 C:\1.cpp passing `char' to argument 1 of `fputs(const char *, FILE *)' lacks a cast 這是哪裡出ㄌ問題...可以幫我解答ㄇ |
把迴圈去掉試試看,然後...
fgets(a[i],73,aa); fputs(a[i],qq); 改成 fgets(a[],73,aa); fputs(a[],qq); <參考看看> |
因為fgets和fputs都是以字串為參數,所以a[i]字符型當成參數會造成問題。
可以直接改成 fgets(a,73,aa); fputs(a,qq); 也可以使用fgetc和fputc加上for |
所有時間均為台北時間。現在的時間是 11:07 AM。 |
Powered by vBulletin® 版本 3.6.8
版權所有 ©2000 - 2025, Jelsoft Enterprises Ltd.
『服務條款』
* 有問題不知道該怎麼解決嗎?請聯絡本站的系統管理員 *