Click here to Skip to main content
15,912,977 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralUMM.... I'm New Pin
EthanEnie16-Nov-04 16:30
EthanEnie16-Nov-04 16:30 
GeneralRe: UMM.... I'm New Pin
Henry miller17-Nov-04 2:09
Henry miller17-Nov-04 2:09 
GeneralRe: UMM.... I'm New Pin
eenie25-Nov-04 16:56
eenie25-Nov-04 16:56 
GeneralRe: UMM.... I'm New Pin
Henry miller29-Nov-04 3:03
Henry miller29-Nov-04 3:03 
GeneralSys Tray Icon Colors Incorrect Pin
azdec16-Nov-04 16:24
azdec16-Nov-04 16:24 
GeneralVisual C++ Extensibility Object Pin
Eyk Boenig16-Nov-04 16:07
Eyk Boenig16-Nov-04 16:07 
Questionwhat is the difference between strcpy and lstrcpy? Pin
freehawk16-Nov-04 15:45
freehawk16-Nov-04 15:45 
AnswerRe: what is the difference between strcpy and lstrcpy? Pin
Jack Puppy16-Nov-04 16:39
Jack Puppy16-Nov-04 16:39 
<br />
char *strcpy( char *string1, const char *string2 );<br />
<br />
LPTSTR lstrcpy(<br />
    LPTSTR  lpString1,	// address of buffer <br />
    LPCTSTR  lpString2 	// address of string to copy <br />
   );<br />


- strcpy works with standard text. (1 byte per character)
- lstrcpy is portable. lstrcpy will copy standard text if you use standard character settings in your project, and will copy Unicode text if you use Unicode character settings. (2 bytes per character)

The "magic" behind this lies with the LPTSTR/LPCTSTR typedefs. When compiled under standard settings LPTSTR = char*, and therefore:

lstrcpy = char*(char* lpString1, const char* lpString2), which is the same as strcpy.

Using Unicode settings, LPTSTR = wchar_t*, and therefore:

lstrcpy = wchar_t*(wchar_t* lpString1, const wchar_t* lpString2), which is the same as wcscpy.

So if you're using lstrcpy in your project, and decide you want to use the Unicode settings, you don't have to change a thing. If you're using strcpy and decide to go Unicode, you would need to replace all your strcpy calls with wcscpy.

I think there's an article on the site about this, you should check it out.


Cool | :cool: Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
GeneralRe: what is the difference between strcpy and lstrcpy? Pin
freehawk16-Nov-04 16:54
freehawk16-Nov-04 16:54 
GeneralRe: what is the difference between strcpy and lstrcpy? Pin
Neville Franks16-Nov-04 23:01
Neville Franks16-Nov-04 23:01 
GeneralRe: what is the difference between strcpy and lstrcpy? Pin
Jack Puppy17-Nov-04 1:08
Jack Puppy17-Nov-04 1:08 
GeneralRe: what is the difference between strcpy and lstrcpy? Pin
David Crow17-Nov-04 3:15
David Crow17-Nov-04 3:15 
GeneralUpdating modeless daialog box Pin
Zero_G16-Nov-04 15:22
Zero_G16-Nov-04 15:22 
GeneralRe: Updating modeless daialog box Pin
bryce16-Nov-04 17:47
bryce16-Nov-04 17:47 
QuestionHow to access Radio Button with just ID Pin
Jack_pt16-Nov-04 15:11
Jack_pt16-Nov-04 15:11 
AnswerRe: How to access Radio Button with just ID Pin
Anonymous16-Nov-04 15:45
Anonymous16-Nov-04 15:45 
GeneralRe: How to access Radio Button with just ID Pin
Jack_pt17-Nov-04 3:11
Jack_pt17-Nov-04 3:11 
AnswerRe: How to access Radio Button with just ID Pin
Jack Puppy16-Nov-04 16:58
Jack Puppy16-Nov-04 16:58 
GeneralRe: How to access Radio Button with just ID Pin
Jack_pt17-Nov-04 3:14
Jack_pt17-Nov-04 3:14 
GeneralRe: How to access Radio Button with just ID Pin
Bo Hunter17-Nov-04 14:05
Bo Hunter17-Nov-04 14:05 
GeneralDesign Pin
Anonymous16-Nov-04 14:37
Anonymous16-Nov-04 14:37 
GeneralRe: Design Pin
Henry miller17-Nov-04 2:20
Henry miller17-Nov-04 2:20 
Generalplay stream audio Pin
don7cry16-Nov-04 14:16
don7cry16-Nov-04 14:16 
Generalgame code Pin
bigdeeoo716-Nov-04 14:09
bigdeeoo716-Nov-04 14:09 
GeneralRe: game code Pin
Maximilien16-Nov-04 14:24
Maximilien16-Nov-04 14:24 

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.