Hi, I am new to this forum. I am required to make a conversion program to convert one file format to the next using the c language. What I want is to have the user type the name of the file for conversion on the terminal, and it will begin its process. Here is what I have so far:
Code:
char *inputconnectfilename;
FILE *InputConnectionFile;
printf("Please input the filename of the connection file (Note: Must be in the same directory of this program)\n");
scanf("%s", inputconnectfilename);
printf("intializing... ");
printf("%s", *inputconnectfilename);
InputConnectionFile = fopen(inputconnectfilename, "r");
if (InputConnectionFile == NULL)
{
printf("\nFailed to open the file.\n");
exit(1);
}
...
The code compiled without any errors. However, no matter what I type for the filename, a segmentation error is there and my "failed to open file" message appeared. Can somebody help me to find what was wrong with this code, and if possible, ways to fix it?
Thanks.