fout.open("abc.txt");
fout<< "Name";
fout.close();
ifstream in;
in.open("abc.txt");
while(!in.eof())
{
in >> Str1; /// Error Comes here no operator ">>" matches these operands
It perfectly does. Check the loop, it read and store each strings from file, then again reads next string. For storing all string in a single buffer you need to add each readStr in a buffer. ie:
Code:
while (!myFile.eof())
{
myFile >> readStr;
szBuf += readStr; //CString szBuf
}
// now you have all the txt from file in CString szBuf here.
Check the file name and path for be sure that you are reading correct file.
And for using fstream did you put using namespace std; at the top. ?
Last edited by hypheni; March 25th, 2011 at 12:48 AM.
Reason: `
Yup i did..its working
in this program i given the string.
Now i am trying to do to take string from the Edit Box but its not Writing in the file puts ASCI and radam numbers
1. Please, use Code tags around code snippets.
2. To help us to help you you should always explain what exact error you had and, if possible, show the exact error message.
3. What is m_List1? Is it a CListBox instance? If *yes* then what can it have to do with a CStdioFile object passed in as a parameter?
You, perhaps, wanted to pass in the CString strFirstLine object containing the text you had read from a file?
I think you need some books and study about windows programming (as well as basic c++) then try to develop some application, rather than asking each steps in forum.
hypheni : Yup i am new to MFC Windows programming. i asked for the related to this ..but no body tell me, so thats why am facing problem in syntax mostly
hypheni : Yup i am new to MFC Windows programming. i asked for the related to this ..but no body tell me, so thats why am facing problem in syntax mostly
New to MFC, Start off with some windows programming book then move to MFC.
Bookmarks