Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

i want to give one file to fopen function. where i have to place that file and what is the path.

0 votes
asked Sep 9, 2021 by sahiti buddalla (120 points)
fopen("hello.txt",r);

where i can place hello.txt. what path i have to given in fopen

1 Answer

0 votes
answered Sep 20, 2021 by Peter Minarik (86,180 points)

If you attach hello.txt to your project (Upload and Crate New File buttons are on the left side of RUN button) then you do not need to specify anything else (no need for full path) just the file name. Also, the r part should be in quotes.

#include <stdio.h>
//...
FILE * file = fopen("hello.txt", "r");
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...