Segmentation fault- strcat
问题 This is my code: #include<stdio.h> #include<stdlib.h> #include<string.h> void main(int arge, char *argv[]) { FILE *f1; char ch,*fn="~/lyrics/"; strcat(fn,argv[1]); strcat(fn,".txt"); if( (f1 = fopen(fn,"r"))==NULL ) { printf("\nWrong filename\n%s not found",argv[1]); return; } while((ch=getw(f1))!=EOF) { printf("%c",ch); } } I compiled it using gcc -g -o file file.c and the compiler gave no error messages. But when I run it I get the error message: Segmentation fault (core dumped) Bad