Click here to Skip to main content
15,897,187 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: What happen when i use functions exported from a dll?? ( low level ) Pin
Mark Salsbery22-Nov-08 20:39
Mark Salsbery22-Nov-08 20:39 
AnswerRe: What happen when i use functions exported from a dll?? ( low level ) [modified] Pin
Jijo.Raj23-Nov-08 1:04
Jijo.Raj23-Nov-08 1:04 
Questioni need some expert design guidelines for realtime 3D graphics application Pin
atillaselem22-Nov-08 12:49
atillaselem22-Nov-08 12:49 
QuestionUNICODE support suggetions required Pin
krishnakumartm22-Nov-08 8:55
krishnakumartm22-Nov-08 8:55 
AnswerRe: UNICODE support suggetions required Pin
Code-o-mat22-Nov-08 9:33
Code-o-mat22-Nov-08 9:33 
AnswerRe: UNICODE support suggetions required Pin
Mark Salsbery22-Nov-08 20:41
Mark Salsbery22-Nov-08 20:41 
AnswerRe: UNICODE support suggetions required Pin
CPallini22-Nov-08 22:16
mveCPallini22-Nov-08 22:16 
QuestionHow to strip special chars from a CString? Pin
Larry Mills Sr22-Nov-08 4:07
Larry Mills Sr22-Nov-08 4:07 
Problem: A User is using "copy and Paste" from a MS Word and MS Works database to enter data into my nprogram. And it fails to accept the special chars contained in each database. How do I strip those special chars from those databases before the User can "copy and Paste" from them?
Heres how I extract the data from my database file into a vector:

void CSystemDB::ConvertStringFromFileSys(CString str)
{
// Take the string data from the file and convert it back to
m_vSys.m_vSysData.clear();
CString e = "";
CString s = "";
CString c = "";
CString d = "";
CString x = "";
m_cSysData.CleanUp();
int sizeOfString = str.GetLength() + 1;
LPTSTR lpsz = new TCHAR[sizeOfString]; //[sizeOfString];
_tcscpy_s(lpsz, sizeOfString, str);
int nStop = 0;
int i = 0;
int ntmp = 0;
int ntmp2 = 0;
d = '*';
e = "";
c = ',';
int ch = 0;
int nQuit = 1;
int nLastchr = sizeOfString - 1;
int index = 1;
for(i = 0; i < nLastchr; i++)
{
switch(index)
{
case 1:// Get m_csOperatorName:
s = "";
nStop = 1;
while(nStop == 1)
{
x = "";
x = lpsz[i];
if(x == c)
{
// a comma exist
x = "";
nStop = 0;
}
else
{
s += lpsz[i];
i++;
}
}//while(nStop == 1)
// Have m_csOperatorName:
m_cSysData.m_csOperatorName = s;
index++;
break;
case 2:// Now get m_csWellName:
s = "";
nStop = 1;
while(nStop == 1)
{
x = "";
x = lpsz[i];
if(x == c)
{
// a comma exist
x = "";
nStop = 0;
}
else
{
s += lpsz[i];
i++;
}
}//while(nStop == 1)
// Have m_csWellName:
m_cSysData.m_csWellName = s;
index++;
break;
case 3:// Get m_csOperator_sdb_FilePath:
s = "";
nStop = 1;
while(nStop == 1)
{
x = "";
x = lpsz[i];
if(x == c)
{
// a comma exist
x = "";
nStop = 0;
}
else
{
s += lpsz[i];
i++;
}
}//while(nStop == 1)
// Have m_csOperator_sdb_FilePath:
m_cSysData.m_csOperator_sdb_FilePath = s;
index++;
break;
case 4:// Now get m_csWell_wdb_FilePath:
s = "";
nStop = 1;
while(nStop == 1)
{
x = "";
x = lpsz[i];
if(x == c)
{
// a comma exist
x = "";
nStop = 0;
}
else
{
s += lpsz[i];
i++;
}
x = "";
}// while(nStop == 1)
// Got m_csWell_wdb_FilePath
m_cSysData.m_csWell_wdb_FilePath = s;
index++;
break;
case 5:// Now Get m_IsFileName:
s = "";
nStop = 1;
while(nStop == 1)
{
x = "";
x = lpsz[i];
if( x == c)
{
x = "";
nStop = 0;
}
else
{
s += lpsz[i];
i++;
}
}//while(nStop == 1)
// Got m_IsFileName:
m_cSysData.m_IsFileName = s;
index++;
break;
case 6:// Now get m_csDirections
s = "";
nStop = 1;
while(nStop == 1)
{
x = "";
x = lpsz[i];
if(x == c)
{
// a comma exist
x = "";
nStop = 0;
}
//
else
{
s += lpsz[i];
i++;
}
}//while(nStop == 1)
// Got m_csDirections
m_cSysData.m_csDirections = s;
index++;
break;
case 7:// Now get m_csTanks:
s = "";
nStop = 1;
while(nStop == 1)
{
x = "";
x = lpsz[i];
if(x == c)
{
// a comma exist
x = "";
nStop = 0;
}
//
else
{
s += lpsz[i];
i++;
}
}//while(nStop == 1)
// Got m_csTanks:
m_cSysData.m_csTanks = s;
index++;
break;
case 8:// Now get m_cs210Wtr:
s = "";
nStop = 1;
while(nStop == 1)
{
x = "";
x = lpsz[i];
if(x == c)
{
// a comma exist
x = "";
nStop = 0;
}
else
{
s += lpsz[i];
i++;
}
}//while(nStop == 1)
// Got m_cs210Wtr:
m_cSysData.m_cs210Wtr = s;
index++;
break;
case 9:// Now get m_cs210Oil:
s = "";
nStop = 1;
while(nStop == 1)
{
x = "";
x = lpsz[i];
if(x == c)
{
// a comma exist
x = "";
nStop = 0;
}
if(x == d)
{
// was '*' end of SysData record
x = "";
nStop = 0;
}
else
{
s += lpsz[i];
i++;
}
}//while(nStop == 1)
m_cSysData.m_cs210Oil = s;
//Got all data put in vector:
m_vSys.m_vSysData.push_back(m_cSysData);
m_cSysData.CleanUp();
s = "";
index = 1;
break;
}// switch
if(i >= nLastchr)
{
break;
}
}//for(...)
delete [] lpsz;
}
I thought about loading another(or several) CStrings with "OD' OR 'OA' Ex: CString CR = 'OD'; but I don't know if that would work in the example code above.

Any help would be appreciated. This is MFC VS2008 code.

A C++ programming language novice, but striving to learn
QuestionRe: How to strip special chars from a CString? Pin
David Crow22-Nov-08 12:25
David Crow22-Nov-08 12:25 
AnswerRe: How to strip special chars from a CString? Pin
Larry Mills Sr24-Nov-08 4:42
Larry Mills Sr24-Nov-08 4:42 
QuestionRe: How to strip special chars from a CString? Pin
David Crow1-Dec-08 3:06
David Crow1-Dec-08 3:06 
QuestionDouble click event for custom tree control Pin
AnithaSubramani22-Nov-08 2:26
AnithaSubramani22-Nov-08 2:26 
AnswerRe: Double click event for custom tree control Pin
Randor 22-Nov-08 2:44
professional Randor 22-Nov-08 2:44 
AnswerRe: Double click event for custom tree control Pin
Rajesh Katalkar24-Nov-08 4:41
Rajesh Katalkar24-Nov-08 4:41 
QuestionHow to change the caption of AfxMessageBox () ? Pin
kapardhi22-Nov-08 1:54
kapardhi22-Nov-08 1:54 
AnswerRe: How to change the caption of AfxMessageBox () ? Pin
Randor 22-Nov-08 2:37
professional Randor 22-Nov-08 2:37 
AnswerRe: How to change the caption of AfxMessageBox () ? Pin
Graham Bradshaw23-Nov-08 2:43
Graham Bradshaw23-Nov-08 2:43 
QuestionInternet Connection Problem Pin
Dhiraj kumar Saini22-Nov-08 1:07
Dhiraj kumar Saini22-Nov-08 1:07 
Questionplease help on operators in matrix class Pin
Jorge22-Nov-08 0:35
Jorge22-Nov-08 0:35 
QuestionRe: please help on operators in matrix class Pin
CPallini23-Nov-08 9:45
mveCPallini23-Nov-08 9:45 
AnswerRe: please help on operators in matrix class Pin
Jorge23-Nov-08 13:40
Jorge23-Nov-08 13:40 
QuestionHow to open .bmp file in paint in MFC? Pin
AnithaSubramani22-Nov-08 0:11
AnithaSubramani22-Nov-08 0:11 
AnswerRe: How to open .bmp file in paint in MFC? Pin
Randor 22-Nov-08 0:35
professional Randor 22-Nov-08 0:35 
AnswerRe: How to open .bmp file in paint in MFC? Pin
Code-o-mat22-Nov-08 0:38
Code-o-mat22-Nov-08 0:38 
AnswerRe: How to open .bmp file in paint in MFC? Pin
Hamid_RT22-Nov-08 2:19
Hamid_RT22-Nov-08 2:19 

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.