String Conversion
-
I am converting a dos app to a windows app. The application changes passwords for given a given user. The dos application accepts servername, username, and password as cmd line arg's. They are defined as char username[50], password[128], etc. My dialog takes the username and password as CString's. How can I convert the CString to make it compatible with the char [50], etc above? Thanks! "Keyboard Error - Press F1 to Continue"
-
I am converting a dos app to a windows app. The application changes passwords for given a given user. The dos application accepts servername, username, and password as cmd line arg's. They are defined as char username[50], password[128], etc. My dialog takes the username and password as CString's. How can I convert the CString to make it compatible with the char [50], etc above? Thanks! "Keyboard Error - Press F1 to Continue"
To make a CString from char[]:
char username[50];
// Fill usernameCString str;
str = username;To make a char[] from CString:
CString str;
// Fill strchar username[50];
memset(username, 0, 50);
strncpy(username, str.LockBuffer(), 50-1);
str.UnlockBuffer();Hope that helps :-D Dominik
_outp(0x64, 0xAD);
and__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do?? ;) (doesn't work on NT) -
To make a CString from char[]:
char username[50];
// Fill usernameCString str;
str = username;To make a char[] from CString:
CString str;
// Fill strchar username[50];
memset(username, 0, 50);
strncpy(username, str.LockBuffer(), 50-1);
str.UnlockBuffer();Hope that helps :-D Dominik
_outp(0x64, 0xAD);
and__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do?? ;) (doesn't work on NT)The calls to
LockBuffer()
andUnlockBuffer()
are not necessary as the second parameter tostrncpy()
is expecting aLPCSTR
, whichCString
provides. The same is true forGetBuffer()
andReleaseBuffer()
. -
The calls to
LockBuffer()
andUnlockBuffer()
are not necessary as the second parameter tostrncpy()
is expecting aLPCSTR
, whichCString
provides. The same is true forGetBuffer()
andReleaseBuffer()
.