[問題] fscanf, fprintf 讀取二維字串

作者: tsungjen   2015-04-21 00:08:59
char resname[100][100];
//我想讀取一個二維的字元陣列
int main()
{
input=fopen("test.gro", "r");
for (int i=0; i<100; i++)
{
fscanf(input, "%s", &resname[i]);
}
for (int i=0; i<100; i++){
fprintf(stderr,"%s\n",resname[i]); // <
作者: LPH66 (-6.2598534e+18f)   2015-04-21 01:43:00
印字元請用 %c
作者: tsungjen   2015-04-21 02:36:00
我打%c跑出奇怪的圖案, 怎麼辦解決了, 多謝一樓

Links booklink

Contact Us: admin [ a t ] ucptt.com