How to load a file on a C program?

Hello I have a program to write and I want to make it load a file.The problem is that I want the user to give the name of the file that he wants to load.He will write the name of the file and the program will search for the file in a certain folder(I know the name of the folder)and then load it in the program.A part of my code so far is:

printf("Give the name of the file you want to open.

gets(search); //"search" is the name of the file to load
FILE *fp;

I want to know how to write the fopen command in order to search for the file inside a specific folder

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!