Click here to Skip to main content
15,892,298 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralPrint with MFC Pin
nikoladsp13-Jan-04 6:21
nikoladsp13-Jan-04 6:21 
GeneralMAC address Pin
Jeremy Falcon13-Jan-04 6:07
professionalJeremy Falcon13-Jan-04 6:07 
GeneralRe: MAC address Pin
Joaquín M López Muñoz13-Jan-04 11:15
Joaquín M López Muñoz13-Jan-04 11:15 
GeneralRe: MAC address Pin
Jeremy Falcon13-Jan-04 12:50
professionalJeremy Falcon13-Jan-04 12:50 
QuestionHow to show dialog in a CTabCtrl Pin
AnTri13-Jan-04 5:05
AnTri13-Jan-04 5:05 
GeneralRegQueryValueEx + DWORD problem Pin
Anonymous13-Jan-04 4:54
Anonymous13-Jan-04 4:54 
GeneralRe: RegQueryValueEx + DWORD problem Pin
G. Steudtel13-Jan-04 6:00
G. Steudtel13-Jan-04 6:00 
GeneralParsing CStrings & Find Strings. Pin
rspringstead200313-Jan-04 4:34
rspringstead200313-Jan-04 4:34 
I have a dilemna. I have not used c++ in years in been thrown in to a project, that should be fairly simple, if I could remember anything about c++. I have a log file that I currently parse looking only for a specific set of data. The program parses the line that I need which is similiar to this:

Test Data A:1234\1234\12345678.dat File error: "Then the Error Message" to A:1234\1234\12345678.dat.$$$.WeekDay Month Day Time Year

I parse out the file looking for Test Data, displaying the entire line to write to the file in the directory.(aSmile | :) Then I need to compare the Error Message with the current possible error messages, if a match is found, write a note in the file stating what the error message means. I am having extreme difficulty getting the program to compare the error message to the possible error message and displaying another.

Copy of Code:

CFile file;
CFile outputfile;
CFileException exception;
int holder = (80);
if (!file.Open(fileNameStr, CFile::modeRead, &exception))
{
return false;
}
int count = 0;

char buffer;
CString TempBuffer;
CParser parser;
parser.Add((int)TOKEN_DATA_FILE, "Test Data ");
parser.Add((int)TOKEN_SECOND, "File Copy Failed on Data File ");
// parser.Add((int)TOKEN_DATA_M, "A: ");
parser.Add((int)TOKEN_MESS_1, "failed decryption ");
parser.Add((int)TOKEN_MESS_2, "Failed Decryption but Decompressed ");
parser.Add((int)TOKEN_MESS_3, "Failed Decompression ");
parser.Add((int)TOKEN_MESS_4, "Failed Decompression but Decrypted ");
parser.Reset();

while (file.Read(&buffer, 1) == 1)
{
T_TokenID currentToken = (T_TokenID)parser.CheckForToken(buffer);

switch ( currentToken )
{
case NO_TOKEN:
break;

case TOKEN_DATA_FILE:
{
CString objectStr("Data File M: ");
CString objectFDD("Failed Decryption & Decompression Message");
CString objectFDBD("Failed Decryption but Decompressed Message");
CString objectFDD2("Failed Decompression & Decryption Message");
CString objectFDBD2("Failed Decompression but Decrypted Message");
while (file.Read(&buffer, 1) == 1 && buffer != '\n')
{
objectStr += buffer;
}
if(objectStr.GetLength() > 95) {

m_lst_itemsInFile.AddString(objectStr);


}
/*
}
break;
case TOKEN_SECOND:
{

CString objectStr("File Copy Failed on Data File ");
while (file.Read(&buffer, 1) == 1 && buffer != '\n')
{
objectStr += buffer;
}

m_lst_itemsInFile.AddString(objectStr);
}
break;
/* case TOKEN_DATA_M:
{

CString objectStr("M:");
while (file.Read(&buffer, 1) == 1 && buffer != '\n')
{
objectStr += buffer;
file.Write(&buffer, 1);
}

m_lst_itemsInFile.AddString(objectStr);
}
break;*/

default:
{
ASSERT(false); // CheckForToken(buffer) should always return a valid T_TokenType
return false;
}
} // switch ( CheckForToken(buffer) )
}

file.Close();
return true;
}


Any help would be greatly appreciated.
GeneralRe: Parsing CStrings & Find Strings. Pin
rspringstead200313-Jan-04 4:45
rspringstead200313-Jan-04 4:45 
GeneralCInternetSession Pin
FerrariDMan13-Jan-04 4:32
FerrariDMan13-Jan-04 4:32 
GeneralUninstalling Pin
act_x13-Jan-04 4:31
act_x13-Jan-04 4:31 
GeneralChanging VC++ compilers Pin
Joel Lipschultz13-Jan-04 4:19
Joel Lipschultz13-Jan-04 4:19 
QuestionCstring::find bug??? Pin
Anonymous13-Jan-04 4:15
Anonymous13-Jan-04 4:15 
AnswerRe: Cstring::find bug??? Pin
RChin13-Jan-04 5:56
RChin13-Jan-04 5:56 
Generalfatal error Pin
Goh Hui Beng13-Jan-04 4:15
Goh Hui Beng13-Jan-04 4:15 
GeneralRe: fatal error Pin
Antti Keskinen13-Jan-04 6:43
Antti Keskinen13-Jan-04 6:43 
GeneralTreeCtrl with customized background --- PROBLEM Pin
TiberiusvP13-Jan-04 4:03
TiberiusvP13-Jan-04 4:03 
GeneralDatabases and C++ Pin
mcsherry13-Jan-04 3:40
mcsherry13-Jan-04 3:40 
GeneralRe: Databases and C++ Pin
pankajdaga13-Jan-04 4:01
pankajdaga13-Jan-04 4:01 
GeneralRe: Databases and C++ Pin
mcsherry13-Jan-04 4:43
mcsherry13-Jan-04 4:43 
GeneralRe: Databases and C++ Pin
RChin13-Jan-04 5:41
RChin13-Jan-04 5:41 
GeneralRe: Databases and C++ Pin
mcsherry13-Jan-04 4:35
mcsherry13-Jan-04 4:35 
GeneralRe: Databases and C++ Pin
RChin13-Jan-04 5:48
RChin13-Jan-04 5:48 
GeneralRe: Databases and C++ Pin
forjer13-Jan-04 6:42
forjer13-Jan-04 6:42 
GeneralDisable ASSERT in Debug mode Pin
misha_grewal13-Jan-04 3:21
misha_grewal13-Jan-04 3:21 

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.