| | |
Is ifs is a member function of ifstream class
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jul 2004
Posts: 1
Reputation:
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.
look at this example ...
--------------------------------------------------------------------------------
C++ Syntax (Toggle Plain Text)
#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; }
C++ Syntax (Toggle Plain Text)
#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
My Resume
My Resume
•
•
•
•
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.C++ Syntax (Toggle Plain Text)
ifstream ifs( g_pSystemEnvironment->GetTotAlmCountFileName() );
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
![]() |
Similar Threads
- Calling a member function inside a class (C++)
- Is It significant to define a member function as static in singleton class (C++)
- stuck on a member function for a class (C++)
- calling oo class member function from c (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...?
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char class classes code coding compile compiler console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream int integer java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news node number output parameter pointer problem program programming project python read recursion recursive reference return rpg string strings struct temperature template templates test text text-file tree unix url variable vector visualstudio win32 windows winsock word wordfrequency wxwidgets






