473,396 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

File Manipulation

Hi All,

could anyone PLEASE halp me, i'm very new to c++, but i need to do the
following:

open data file
read file from X to Y
create a new file called X.txt
write data inbetween X and Y into file X.txt

just keep getting stuck at how to creta a file with a name known at runtime.

The names X.txt are call numbers, read from a data file, and the data is a
call log. Just want a way to split up the 1 huge file into individual files
with the name of teh call number.

All suggestiosn VERY welcome.

Many thanks,

Darren
Jul 19 '05 #1
1 3536
In article <P4***************@newsfep3-gui.server.ntli.net>,
Darren <fo*****@world.com> wrote:

just keep getting stuck at how to creta a file with a name known at runtime.


#include <iostream>
#include <string>
#include <fstream>

using namespace std;

int main ()
{
cout << "Enter the name of the output file: ";
string filename;
cin >> filename;

ofstream outfile (filename.c_str());
outfile << "fee fie foe fum" << endl;
outfile.close();

return 0;
}

--
Jon Bell <jt*******@presby.edu> Presbyterian College
Dept. of Physics and Computer Science Clinton, South Carolina USA
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Paul Moore | last post by:
Does anyone know of a Python library which handles sound file formats (MP3, Ogg, FLAC are the three I'm nost interested in). I'd like something that can manipulate "metadata" - stuff like artist,...
7
by: Dennis C. Drumm | last post by:
I would like to be able to update an xml file located on my hosted server from my local computer. The server requires a user name and password to access the web site for writing or updating...
1
by: ma740988 | last post by:
Trying to some of my reading on file manipulation (ifstream/ofstream/fstream) into action. So now consider. # include <iostream> # include <fstream> # include <cstring> # include <sstream> ...
2
by: PFI | last post by:
Hi, I recently installed SQL Server 2005 Enterprise Edition (9.0.1399) and I have problems on queries concerning system file manipulation... For example, when I try to increase the Log File of...
4
by: magix | last post by:
Dear Guru, I'm not so good in file manipulation, but would like to seek for help here. I have following basic code of command line argument as starting point (the code below output the...
1
by: scubber | last post by:
hi, im new (as you're going to painfully aware of in a minute) to programming and was wondering if anyone could help with this little problem: i am trying to read a number of values which are...
0
by: L'eau Prosper Research | last post by:
Press Release: L'eau Prosper Research (Website: http://www.leauprosper.com) releases new TradeStation 8 Add-on - L'eau Prosper Market Manipulation Profiling Tools Set. L'eau Prosper Market...
0
by: L'eau Prosper Research | last post by:
NEW TradeStation 8 Add-on - L'eau Prosper Market Manipulation Profiling Tools Set By L'eau Prosper Research Press Release: L'eau Prosper Research (Website: http://www.leauprosper.com) releases...
1
by: tourist.tam | last post by:
Hi, I am trying to read a file using a BufferedStream and avoiding at maximum the use of string manipulation. I need now some help understanding on how to use byte array to hold the data and...
15
by: pakerly | last post by:
How would i do this, convert a test file to excel? Lets say my text file has fields like this: NUMBER NAME ADDRESS PHONE 11002 Test1 ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.