Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3042

[RESOLVED] Extracting time stamps from pdf

$
0
0
Hi, I am trying to automatically extract all time stamps in a pdf file. These are typically in a line like:

when="2010-07-30T15:20:30+04:00"

For this I was thinking of using CStdioFile and the ReadString function. Somehow this doesn't work. My example code is below. Is this because pdf is not a true text file, because strings read can be longer than some max,...? What is my mistake or anyone have another quick way of reading the file and extracting the desired text between the brackets?

Code:

CStdioFile InputFile;

if (InputFile.Open(FileName,CFile::modeRead))
{
 CString Line; CString ToFind; ToFind.Format("when");
       
 while (InputFile.ReadString(Line))
 {
  if (Line.Find(ToFind)!=-1)
  {
  CString Item; AfxExtractSubString(Item,Line,0,'"');
  AfxMessageBox(Item); // to be replaced with further processing
  }
 }

 InputFile.Close();
}


Viewing all articles
Browse latest Browse all 3042

Trending Articles