Hi, I am working on a program that read's in a file
and i want the user to manage what file to read in(the file name), and what file to write to.
can someone help me with that ?
thanks //Primus
5 1805
Hi, I am working on a program that read's in a file
and i want the user to manage what file to read in(the file name), and what file to write to.
can someone help me with that ?
thanks //Primus
You will let the user to set the Input and Output File name?
Or something else you want?
Kind regards,
Dmjpro.
Hi, I am working on a program that read's in a file
and i want the user to manage what file to read in(the file name), and what file to write to.
can someone help me with that ?
thanks //Primus
Sure, what do you have so far or where are you getting stuck?
yes exactly, user will be asked to enter file name to read from, or to write to.
so that u can save things in one file then load from another file.
so far i know how to read and write from/to a file that is in the "code",
i specify file name before i compile in the program source code. -
-
FILE *writefile;
-
writefile = fopen("movielist.txt","wt");
-
-
while (list[i].occupied == 1)
-
{
-
fprintf(writefile, "%s",list[i].name);
-
fprintf(writefile, "%s",list[i].genre);
-
fprintf(writefile, "%d\n",list[i].year);
-
fprintf(writefile, "%d\n",list[i].grade);
-
i++;
-
}
-
-
fclose(writefile);
-
-
do not worry about list[i].occupied, this piece of code does work, if the file
movielist.txt exist in the same directory.
i had an idea to do it like this: writefile = fopen("%s(myfilename)","w");
did not work so well
thanks // Primus
yes exactly, user will be asked to enter file name to read from, or to write to.
so that u can save things in one file then load from another file.
so far i know how to read and write from/to a file that is in the "code",
i specify file name before i compile in the program source code.
do not worry about list[i].occupied, this piece of code does work, if the file
movielist.txt exist in the same directory.
i had an idea to do it like this: writefile = fopen("%s(myfilename)","w");
did not work so well
thanks // Primus
I'm sorry, I'm not sure what you are asking, are you trying to append the path to the file name? As you said, your code works, what is your question?
You will let the user to set the Input and Output File name?
Or something else you want?
Kind regards,
Dmjpro.
this is what i want, i think i said that in the first post, and my second post was a
complement to that one. Any how, i try to express my self better now, my question being:
How do i let the user chose the file name, user being he person who runs the
program.
I have some data in the program and i want to output it to a file that don't exist.
And so let the user make the file name, path is not important. And the same thing to input data from a file to the program.
The user should specify file name when deeling with file operations
I really hope this is clear ?
thanks / Primpa
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Joca |
last post by:
Hi.
I have a problem with a dirname. I can´t read a file if i write this code:
<?php
$user = $_REQUEST;
$filename = dirname(_FILE_).'/../revadv/$user';
$lines = file($filename);
?>
|
by: Scott Chang |
last post by:
Hi all,
I loaded the following program 'HelloMCPP' to my MS
VC++ .NET (2002) that is installed on my Windows XP
Professional PC:
-------------------------------------
AssemblyInfo.cpp...
|
by: Richard |
last post by:
Hi all,
Is there any class in .NET 1.x that will help me set file & folder
permissions for a user? Aka - I would like to do the in code equivalent of
right clicking a folder in file explorer...
|
by: spentun |
last post by:
How can I moitor file which is executed by user or program in window.
I need to write a code to monitor file. When user clicks the file(.exe) or
is called by program, the name of file will be...
|
by: lactaseman |
last post by:
While I know this is not the correct venue... I realize this is of
little to no importance to most out there... however, if I had found
this in my initial searches, I would have used this. So, as...
|
by: forest demon |
last post by:
for example, let's say I do something like,
System.Diagnostics.Process.Start("notepad.exe","sample.txt");
if the user does a SaveAs (in notepad), how can i capture the path that
the user...
|
by: jacob navia |
last post by:
Hi
We are rewriting the libc for the 64 bit version of lcc-win
and we have added a new field in the FILE structure:
char *FileName;
fopen() will save the file name and an accessor function
will...
|
by: CSharp-Jay |
last post by:
So I have been programming in C# on a personal level as of lately, and
am curious about something. Lately I have been experimenting around
with file create/write, etc. I can open and read the...
|
by: Visine_Eyes |
last post by:
What .NET mechanism should I use to resolve permission issues before I
begin to copy directory structure/file(s) from one computer to another. I
have tried Try/Catch statement using DirectoryInfo...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| | |