473,326 Members | 2,134 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,326 software developers and data experts.

fstream,ifstream,ofstream

i just need to know why ifstream and ofstream are used ??
Jul 28 '15 #1

✓ answered by donbock

Is your question: "Why would anybody use ifstream or ofstream when they could just use fstream?"

4 2486
weaknessforcats
9,208 Expert Mod 8TB
They are part of the C++ Standard Template Library.

I can't answer this until you understand templates and polymorphism.

Until then, you use these if you use the standard library. If you use something else, then you can ignore these.
Jul 28 '15 #2
donbock
2,426 Expert 2GB
Is your question: "Why would anybody use ifstream or ofstream when they could just use fstream?"
Jul 29 '15 #3
yup . i wanna know the clear concepts of ifstream and ofstream,could uh plz tell me a difference briefly...thanks!
Aug 2 '15 #4
donbock
2,426 Expert 2GB
ifstream is for input only.
ofstream is for output only.
fstream is for input, or output, or input mixed with output.

fstream is more powerful, but also more complicated to use.
Aug 2 '15 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Maya | last post by:
Apart from being a pointer, what would be the benefit of using 'std::filebuf' than using the std::fstream? As far as I can see, I would use the same methods in 'filebuf' that I would when using...
1
by: phoenix | last post by:
How can i read a numbers from file.. I created this file like this: int dane, i; std::ofstream plik_z; plik_z.open(nazwa, std::ios::out | std::ios::trunc | std::ios::binary); for (i = 0; i <...
2
by: bballmitch | last post by:
I have the following code #include <cstdlib> #include <iostream> #include <fstream> int score_one=2345, score_two=1800, score_three=1500, score_four=1300, score_five=1100; int ...
3
by: John Smith | last post by:
I would like to write over a file if it exists (or create one if it doesn't exist). The following codes do nothing if the file already exists. How do I get it to overwrite an existing file? ...
2
by: Chris Theis | last post by:
Hello, as stated by the standard the fstream derivatives (ifstream & ofstream) expect a const char* parameter indicating the file name associated with the stream to be opened. I wondered why...
5
by: mastern200 | last post by:
I need to make a program where it can read from a file and write to it. But the problem is, all i can do is read from it and not write to it. This is the code i have so far: # include <iostream>...
7
by: Soneji | last post by:
*sigh* Ok, I have two questions. First, my setup: Win-doze XP-SP2; & Dev-C++ 4.9.9.2; I recently started trying to use 'fstream' to work my input/output, and I noticed that using the...
2
by: mauricesmith42 | last post by:
Sorry i know this is rather large to be posting, but in order to understand the question you have to see all the code //#include <windows.h> //needed for opening folders #include...
2
by: raheelX | last post by:
okay so i want to design a class that will open a text file and manipulate the data in it. and i have to use all these functions from fstream like ifstream, ofstream, seekg etc. the problem is that i...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.