Click here to Skip to main content
15,889,992 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCompile error c2664 Pin
Claude Gagnon12-May-03 3:56
Claude Gagnon12-May-03 3:56 
GeneralRe: Compile error c2664 Pin
David Crow12-May-03 4:29
David Crow12-May-03 4:29 
GeneralRe: Compile error c2664 Pin
Claude Gagnon12-May-03 4:42
Claude Gagnon12-May-03 4:42 
GeneralRe: Compile error c2664 Pin
G. Steudtel12-May-03 4:51
G. Steudtel12-May-03 4:51 
GeneralRe: Compile error c2664 Pin
Jason Henderson12-May-03 7:00
Jason Henderson12-May-03 7:00 
GeneralUsing Updated Interface Pin
swarup12-May-03 3:17
swarup12-May-03 3:17 
QuestionFix SQLStatement error ? Pin
_skidrow_vn_12-May-03 3:14
_skidrow_vn_12-May-03 3:14 
AnswerRe: Fix SQLStatement error ? Pin
basementman12-May-03 5:28
basementman12-May-03 5:28 
You should really have some sort of DB class that would automatically handle this kind of stuff for you, including replacing NULLs and such. An example would be the following:

int ApplicationInstance::StringReplace(char *cpSearch, LPCSTR cpFind, LPCSTR cpReplace, BOOL bDisableNULLCheck /*=FALSE*/, BOOL bReplaceEmbeddedQuotes /*=FALSE*/)
{
if (!cpReplace || (*cpReplace == 0 && !bDisableNULLCheck))
return 0;

int iRetval = 0;
BOOL bDeleteBuf = FALSE;
char *cpReplaceBuf = (char *)cpReplace;

int iReplaceLength = strlen(cpReplaceBuf);
int iFindLength = strlen(cpFind);

if (bReplaceEmbeddedQuotes && strchr(cpReplaceBuf,'\''))
{
LPCSTR cpQuote = strchr(cpReplaceBuf,'\'');
while (cpQuote)
{
iReplaceLength++;
cpQuote = strchr(cpQuote+1,'\'');
}

cpReplaceBuf = new char[iReplaceLength+1];

if (!cpReplaceBuf)
return -1;

char *cpDest = cpReplaceBuf;
cpQuote = cpReplace;

while (*cpQuote)
{
*cpDest++ = *cpQuote;
if (*cpQuote == '\'')
{
*cpDest++ = '\'';
}

cpQuote++;
}

*cpDest = 0;

bDeleteBuf = TRUE;
}


BOOL bSmaller = (iReplaceLength <= iFindLength);

char *p = strstr(cpSearch,cpFind);
while (p)
{
iRetval++;

// move rest of string so that the replace value fits right in.
if (bSmaller)
strcpy(p+iReplaceLength,p+iFindLength);
else
memmove(p+iReplaceLength,p+iFindLength,strlen(p+iFindLength)+1);

memcpy(p,cpReplaceBuf,iReplaceLength);

p = strstr(cpSearch,cpFind);
}

if (bDeleteBuf)
delete [] cpReplaceBuf;

return iRetval;
}

QuestionHow can I use system cmd without opening console? Pin
YanivNahum12-May-03 3:11
YanivNahum12-May-03 3:11 
AnswerRe: How can I use system cmd without opening console? Pin
swarup12-May-03 3:31
swarup12-May-03 3:31 
AnswerRe: How can I use system cmd without opening console? Pin
David Crow12-May-03 3:44
David Crow12-May-03 3:44 
Answerthanks swarup & DavidCrow - great help Pin
YanivNahum12-May-03 4:20
YanivNahum12-May-03 4:20 
GeneralAdobe Acrobat ActiveX Control Pin
Poul Haahr Klemmensen12-May-03 2:17
Poul Haahr Klemmensen12-May-03 2:17 
GeneralRe: Adobe Acrobat ActiveX Control Pin
Paul Selormey12-May-03 4:27
Paul Selormey12-May-03 4:27 
GeneralRe: Adobe Acrobat ActiveX Control Pin
Poul Haahr Klemmensen12-May-03 20:27
Poul Haahr Klemmensen12-May-03 20:27 
GeneralRe: Adobe Acrobat ActiveX Control Pin
Paul Selormey12-May-03 20:42
Paul Selormey12-May-03 20:42 
GeneralUploading file thru WININET Pin
Tili12-May-03 2:12
Tili12-May-03 2:12 
GeneralRe: Uploading file thru WININET Pin
Asmenok30-Sep-03 3:16
Asmenok30-Sep-03 3:16 
General3d game.. like DOOM for console:) Pin
Member 25795612-May-03 2:12
Member 25795612-May-03 2:12 
QuestionHow to knew that a NT/2000 User has logon on? Pin
GooBears12-May-03 2:09
GooBears12-May-03 2:09 
AnswerRe: How to knew that a NT/2000 User has logon on? Pin
Maxwell Chen13-May-03 1:19
Maxwell Chen13-May-03 1:19 
QuestionWhere to Find MFC FAQ? Pin
Haja12-May-03 1:52
Haja12-May-03 1:52 
AnswerRe: Where to Find MFC FAQ? Pin
Kevin McFarlane12-May-03 1:58
Kevin McFarlane12-May-03 1:58 
GeneralRe: Where to Find MFC FAQ? Pin
GooBears12-May-03 2:06
GooBears12-May-03 2:06 
AnswerRe: Where to Find MFC FAQ? Pin
David Crow12-May-03 2:29
David Crow12-May-03 2:29 

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.