I am trying to create a program that will ask the user for a file name and then read that file. This is the first part of an assignment that will teach us how to encrypt plain text files. Here is what i have so far:
When i run this program, i am asked to enter the file name but after i do, it just closes.
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
char filename[20];
printf("Enter the file name");
scanf("%s",filename);
FILE *fileptr;
fileptr=fopen(filename,"r");
}
When i run this program, i am asked to enter the file name but after i do, it just closes.