Click here to Skip to main content
15,888,351 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCreateFile API Hook [modified] Pin
capricious_00122-Jul-06 0:15
capricious_00122-Jul-06 0:15 
AnswerRe: CreateFile API Hook Pin
Stephen Hewitt22-Jul-06 0:30
Stephen Hewitt22-Jul-06 0:30 
QuestionReading from a text file (2 q's) Pin
jon-8021-Jul-06 23:34
professionaljon-8021-Jul-06 23:34 
AnswerRe: Reading from a text file (2 q's) Pin
Garth J Lancaster22-Jul-06 0:36
professionalGarth J Lancaster22-Jul-06 0:36 
GeneralRe: Reading from a text file (2 q's) Pin
ovidiucucu22-Jul-06 1:36
ovidiucucu22-Jul-06 1:36 
GeneralRe: Reading from a text file (2 q's) Pin
Garth J Lancaster22-Jul-06 2:08
professionalGarth J Lancaster22-Jul-06 2:08 
GeneralRe: Reading from a text file (2 q's) Pin
ovidiucucu22-Jul-06 3:35
ovidiucucu22-Jul-06 3:35 
AnswerRe: Reading from a text file (2 q's) Pin
ovidiucucu22-Jul-06 1:33
ovidiucucu22-Jul-06 1:33 
Here is a simple function which reads a text file line by line and fills a CStringArray:
void CSentenceAr::ReadTextFile(LPCTSTR pszFile)
{
   m_strSentences.RemoveAll();
   TRY
   {
      // both, the below constructor and ReadString can throw CFileException
      CStdioFile file(pszFile, CFile::modeRead);
      CString strLine;
      while(file.ReadString(strLine))
      {
         m_strSentences.Add(strLine);
      }
   }
   CATCH(CFileException, e)
   {
      e->ReportError(); // show what's going wrong
   }
   END_CATCH
}

NOTE: Once you can solve the problem using only MFC, it has no sense to mix STL (fstream) stuff.
However, when you do it, don't forget 'using namespace std', or write 'std::fstream'

Ovidiu Cucu
Microsoft MVP - Visual C++

GeneralThanks for the solution Pin
jon-8022-Jul-06 2:07
professionaljon-8022-Jul-06 2:07 
QuestionConvert C++ strings to C-style string (char*) in VC++ 6.0 Pin
Dhananjayak0221-Jul-06 23:31
Dhananjayak0221-Jul-06 23:31 
AnswerRe: Convert C++ strings to C-style string (char*) in VC++ 6.0 Pin
Stephen Hewitt22-Jul-06 0:35
Stephen Hewitt22-Jul-06 0:35 
AnswerRe: Convert C++ strings to C-style string (char*) in VC++ 6.0 Pin
Naveen22-Jul-06 0:38
Naveen22-Jul-06 0:38 
AnswerRe: Convert C++ strings to C-style string (char*) in VC++ 6.0 Pin
Eytukan22-Jul-06 5:11
Eytukan22-Jul-06 5:11 
GeneralRe: Convert C++ strings to C-style string (char*) in VC++ 6.0 Pin
Dhananjayak0222-Jul-06 8:43
Dhananjayak0222-Jul-06 8:43 
AnswerRe: Convert C++ strings to C-style string (char*) in VC++ 6.0 Pin
ThatsAlok23-Jul-06 21:19
ThatsAlok23-Jul-06 21:19 
Questionchange image resolution Pin
QuickDeveloper21-Jul-06 22:33
QuickDeveloper21-Jul-06 22:33 
AnswerRe: change image resolution Pin
Naveen21-Jul-06 23:13
Naveen21-Jul-06 23:13 
AnswerRe: change image resolution Pin
Hamid_RT21-Jul-06 23:36
Hamid_RT21-Jul-06 23:36 
AnswerRe: change image resolution Pin
ThatsAlok23-Jul-06 21:18
ThatsAlok23-Jul-06 21:18 
Questionhide a process! Pin
farshad.f21-Jul-06 22:24
farshad.f21-Jul-06 22:24 
AnswerRe: hide a process! Pin
Naveen21-Jul-06 23:17
Naveen21-Jul-06 23:17 
AnswerRe: hide a process! Pin
Stephen Hewitt22-Jul-06 0:38
Stephen Hewitt22-Jul-06 0:38 
AnswerRe: hide a process! Pin
Eytukan22-Jul-06 4:43
Eytukan22-Jul-06 4:43 
GeneralRe: hide a process! Pin
ThatsAlok23-Jul-06 21:15
ThatsAlok23-Jul-06 21:15 
AnswerRe: hide a process! Pin
ThatsAlok23-Jul-06 21:15
ThatsAlok23-Jul-06 21:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.