Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > help on opening files in c++

Reply
Thread Tools

help on opening files in c++

 
 
DeeVee
Guest
Posts: n/a
 
      07-22-2003
I am very new to the language.
I am trying to open up to ten files from a list of many data files and
writing them all to one big file. To do this I am getting them
individually from the console each time i run the program. For example
each time I run the program I have to type:
c:/dev-cpp/file1/vnov94_b.txt
c:/dev-cpp/file1/faug74_a.txt
etc...
etc...

Do anyone have a simple idea so that i can do this much quicker?
I was thinking maybe if I just had to type the actual file and not the
whole path but im sure on how to do that. Thanks

This is what i have
for (int filecount=0; filecount<10;filecount++) {
char *a;
cin>>a;
if (*a=='x') break;
ofstream outfile("c:/dev-cpp/file1/abc.txt",ios:ut |
ios::app);
ifstream infile(a);
etc...
 
Reply With Quote
 
 
 
 
Karl Heinz Buchegger
Guest
Posts: n/a
 
      07-22-2003


DeeVee wrote:
>
> I am very new to the language.
> I am trying to open up to ten files from a list of many data files and
> writing them all to one big file. To do this I am getting them
> individually from the console each time i run the program. For example
> each time I run the program I have to type:
> c:/dev-cpp/file1/vnov94_b.txt
> c:/dev-cpp/file1/faug74_a.txt
> etc...
> etc...
>
> Do anyone have a simple idea so that i can do this much quicker?


The simplest thing might be something your console provides. Depending
on the operating system you are using, you might be able to use input
redirection. Eg. on DOS you could do:

* create a text file which holds all the file names, eg. files.txt
* start your program like this

myprog < files.txt

The command prompt (the console) will feed the content of files.txt
to your program as if you had typed it.


--
Karl Heinz Buchegger
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Files opening under other files nof NZ Computing 2 01-14-2011 06:07 AM
Problem with opening Excel after opening Excel inside Microsoft Internet Controls fniles ASP General 0 04-26-2009 09:39 PM
Anyone resolved links opening blank page? or box opening in Outlook 2000? S.Rodgers Firefox 13 12-16-2005 03:07 PM
Word file not opening from Adm -My recent docs but opening from file menu of Word Thaqalain Computer Support 0 06-30-2005 02:20 AM
need some help with dial box opening when opening a folder John Computer Information 0 11-13-2003 08:38 PM



Advertisments