Click here to Skip to main content
15,886,724 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Error happen when open file while migrate VC++ 6 to VS2008 Pin
Andraw11119-Jul-12 6:17
Andraw11119-Jul-12 6:17 
GeneralRe: Error happen when open file while migrate VC++ 6 to VS2008 Pin
Andraw11119-Jul-12 6:25
Andraw11119-Jul-12 6:25 
AnswerRe: Error happen when open file while migrate VC++ 6 to VS2008 Pin
jschell20-Jul-12 7:15
jschell20-Jul-12 7:15 
Generalsearch for a word in a text file Pin
byank18-Jul-12 2:14
byank18-Jul-12 2:14 
QuestionRe: search for a word in a text file Pin
David Crow18-Jul-12 2:18
David Crow18-Jul-12 2:18 
AnswerRe: search for a word in a text file Pin
byank19-Jul-12 11:00
byank19-Jul-12 11:00 
GeneralRe: search for a word in a text file Pin
David Crow20-Jul-12 2:24
David Crow20-Jul-12 2:24 
GeneralRe: search for a word in a text file Pin
Shaunak De20-Jul-12 3:17
Shaunak De20-Jul-12 3:17 
If you are searching for a string in a text file do this:

C++
 CString oneLine;     //initialize a CString 
 bool flag = FALSE;   //flag for result
 CStdioFile  fS (_path_, CFile::modeRead ); //open the file
 int lineNumber = 0;   //hold the line number
 while( fS.readLine(oneLine))  //readLine returns false if EOF
  {
    if( oneLine.Find(L"String")!= -1 )  //Find returns -1 if no match
    { flag = TRUE; break; }
   lineNumber++;   //iterate lineNumber
  }
//lineNumber will hold the line in which the string was found. To get exact character place store what Find returns somewhere.


See also:
Find
CStdioFile
GeneralRe: search for a word in a text file Pin
David Crow20-Jul-12 4:51
David Crow20-Jul-12 4:51 
GeneralRe: search for a word in a text file Pin
byank20-Jul-12 7:28
byank20-Jul-12 7:28 
GeneralRe: search for a word in a text file Pin
Software_Developer18-Jul-12 3:40
Software_Developer18-Jul-12 3:40 
GeneralRe: search for a word in a text file Pin
byank19-Jul-12 11:05
byank19-Jul-12 11:05 
QuestionParseExact - parsing a date with a given format in C++ / MFC Pin
BadJerry18-Jul-12 0:50
BadJerry18-Jul-12 0:50 
AnswerRe: ParseExact - parsing a date with a given format in C++ / MFC Pin
Jochen Arndt18-Jul-12 2:27
professionalJochen Arndt18-Jul-12 2:27 
AnswerRe: ParseExact - parsing a date with a given format in C++ / MFC Pin
Richard MacCutchan18-Jul-12 3:20
mveRichard MacCutchan18-Jul-12 3:20 
GeneralRe: ParseExact - parsing a date with a given format in C++ / MFC Pin
BadJerry18-Jul-12 3:32
BadJerry18-Jul-12 3:32 
AnswerRe: ParseExact - parsing a date with a given format in C++ / MFC Pin
Software_Developer18-Jul-12 4:54
Software_Developer18-Jul-12 4:54 
GeneralRe: ParseExact - parsing a date with a given format in C++ / MFC Pin
BadJerry18-Jul-12 5:41
BadJerry18-Jul-12 5:41 
GeneralRe: ParseExact - parsing a date with a given format in C++ / MFC Pin
Richard MacCutchan18-Jul-12 7:39
mveRichard MacCutchan18-Jul-12 7:39 
GeneralRe: ParseExact - parsing a date with a given format in C++ / MFC Pin
jschell20-Jul-12 7:28
jschell20-Jul-12 7:28 
GeneralRe: ParseExact - parsing a date with a given format in C++ / MFC Pin
Richard MacCutchan20-Jul-12 9:21
mveRichard MacCutchan20-Jul-12 9:21 
GeneralRe: ParseExact - parsing a date with a given format in C++ / MFC Pin
Software_Developer18-Jul-12 21:12
Software_Developer18-Jul-12 21:12 
AnswerRe: ParseExact - parsing a date with a given format in C++ / MFC Pin
krmed18-Jul-12 10:04
krmed18-Jul-12 10:04 
GeneralRe: ParseExact - parsing a date with a given format in C++ / MFC Pin
BadJerry18-Jul-12 22:45
BadJerry18-Jul-12 22:45 
GeneralRe: COleDateTime::Format("%A, %B %d, %Y") Pin
Software_Developer19-Jul-12 6:16
Software_Developer19-Jul-12 6:16 

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.