use of fopen

Posted on 2006-04-26
Medium Priority
Last Modified: 2010-04-15
Hi!I need your help..My problem is:

User will enter something for example "teachers.txt" and i will put this entry into a string and open a file with the same name by the fopen function..How i can do this?
Question by:btocakci
  • 2
LVL 12

Expert Comment

ID: 16542148
You can use command line argument to take the filename.
Then use this filename to open the file.
LVL 12

Accepted Solution

rajeev_devin earned 210 total points
ID: 16542154
character string cna be passed to fopen function like this
char fileName[100];
fopen(fileName, "r");

Rest is your work. Gook luck.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
Suggested Courses

750 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question