>       filename[strnum-4] = '.';
>       filename[strnum-3] = 't';
>       filename[strnum-2] = 'x';
>       filename[strnum-1] = 't';
>       filename[strnum] = '\0';
strcpy(filename-4,".txt");
遅くてもこう書き直したい。