First of all please make sure that you follow what the forum members are trying to say to you.
i'm writing this for a university course...
usually i wouldn't use an unsafe function like gets(), but since i am to assume all input is valid, i don't really see the point.
.
as for the implicit main...
i heard that's a problem, but that's how i learned and it doesn't seem to cause any trouble.
main is not supposed to be used like that and so is the gets() . There are other functions which can be used like scanf. And as was pointed out earlier make use of strcat() which adds two strings.
[insert]
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char input[50];
FILE* f1;
char out;
while(1)
{
printf("enter filename (up to 50 chars): ");
//gets(input);
scanf("%s", input);
strcat(input,".txt");
f1=fopen(input,"r");
printf("\n");
if(f1)
{
while ((out = fgetc(f1)) != EOF)
printf("%c",out);
printf("\n------------------------------------------------------------\n");
}
}
return 0;
}