•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 397,850 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,329 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser:
Views: 3080 | Replies: 2
![]() |
•
•
Join Date: Jul 2004
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hi all,
can anyone tell me whether ifs function is a member function of ifstream.
in the statements below the ifs has been used like ........
ifstream ifs( g_pSystemEnvironment->GetTotAlmCountFileName() );
ifs >> m_nNoOfTotalAlarm;
i am not able to understand the code. could anyone help me out of it.
Thanx in advance.
can anyone tell me whether ifs function is a member function of ifstream.
in the statements below the ifs has been used like ........
ifstream ifs( g_pSystemEnvironment->GetTotAlmCountFileName() );
ifs >> m_nNoOfTotalAlarm;
i am not able to understand the code. could anyone help me out of it.
Thanx in advance.
•
•
Join Date: May 2004
Location: Egypt - Cairo
Posts: 129
Reputation:
Rep Power: 5
Solved Threads: 2
look at this example ...
--------------------------------------------------------------------------------
#include <fstream> β’ <fstream> header file
using namespace std; β Use ifstream for input
int main() β Use ofstream for output
{
ifstream ifs;
ifs.open(βin.txtβ?); β’ Other methods
ofstream ofs(βout.txtβ?); β open, is_open, close
if (ifs.is_open() && β getline
ofs.is_open()){ β seekg, seekp
int i; β’ File modes
ifs >> i; β in, out, ate, app, trunc, binary
ofs << i;
}
ifs.close();
ofs.close();
return 0;
}#include <iostream> β’ <sstream> header file
#include <fstream> β Use istringstream for input
#include <sstream> β Use ostringstream for output
using namespace std;
int main() { β’ Useful for scanning input
ifstream ifs(βin.txtβ?); β Get a line from file into string
if (ifs.is_open()) β Wrap string in a stream
{string line1, word1; β Pull words off the stream
getline(ifs, line1); β’ Useful for formatting output
istringstream iss(line1); β Use string as format buffer
iss >> word1; β Wrap string in a stream
cout << word1 << endl; β Push formatted values into stream
} β Output formatted string to file
return 0;
} Real Eyes Realize Real Lies
•
•
•
•
Originally Posted by psk
can anyone tell me whether ifs function is a member function of ifstream.i am not able to understand the code. could anyone help me out of it.ifstream ifs( g_pSystemEnvironment->GetTotAlmCountFileName() );
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
Similar Threads
- String class (C++)
- illegal call of non-static member function (C++)
- performance benefit by not calling static member function by object (C)
- How many member functions in Thing class? (C)
- String declaration in class definition (C)
- Practical application of static member function (C++)
Other Threads in the C++ Forum
- Previous Thread: Saving a file using C++
- Next Thread: VC++:convert File IStream to hex and store...?



Linear Mode