Click here to Skip to main content
15,898,035 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: RegOpenKeyEx gets error 5 (ERROR_ACCESS_DENIED) Pin
Richard Andrew x6417-Feb-11 11:55
professionalRichard Andrew x6417-Feb-11 11:55 
GeneralRe: RegOpenKeyEx gets error 5 (ERROR_ACCESS_DENIED) Pin
Maxwell Chen17-Feb-11 15:33
Maxwell Chen17-Feb-11 15:33 
GeneralRe: RegOpenKeyEx gets error 5 (ERROR_ACCESS_DENIED) Pin
ShilpiP17-Feb-11 17:39
ShilpiP17-Feb-11 17:39 
Questionstructure to file [REMAIN UNSOLVED] [CLOSED] Pin
goldenrose916-Feb-11 6:00
goldenrose916-Feb-11 6:00 
AnswerRe: structure to file Pin
Richard MacCutchan16-Feb-11 6:16
mveRichard MacCutchan16-Feb-11 6:16 
GeneralRe: structure to file Pin
goldenrose916-Feb-11 7:08
goldenrose916-Feb-11 7:08 
AnswerRe: structure to file Pin
David Crow16-Feb-11 7:56
David Crow16-Feb-11 7:56 
GeneralRe: structure to file [modified] Pin
goldenrose916-Feb-11 15:36
goldenrose916-Feb-11 15:36 
DavidCrow wrote:
You probably meant to use _tcscpy() here instead.


This works like a charm

_tcscpy(st.detail.Name,TEXT("Williams"));
_tcscpy(st.detail.Address,TEXT("B-33 Lane 5"));



But another problem arises cannot set values in long and DWORD variables

struct Detail{
	wchar_t Name[25];         
	long	Age;              
	wchar_t Address[100];
};

struct Student{
	Detail detail;
	DWORD code;
};

Student st;
st.code = 1;


but st.code stores a default value of -16843010 and same problem with long data type st.Details.Age = 25 stores 65278, instead of 25.
Confused | :confused: WTF | :WTF:



MODIFIED:
_tcscpy_s() now works. i was making a small mistake. Now it works..

_tcscpy_s(st.detail.Name,_tcslen(st.detail.Name),TEXT("WILLIAMS"));

Some Day I Will Prove MySelf :: GOLD
modified on Wednesday, February 16, 2011 10:43 PM

GeneralRe: structure to file Pin
David Crow16-Feb-11 16:33
David Crow16-Feb-11 16:33 
GeneralRe: structure to file Pin
ShilpiP16-Feb-11 19:33
ShilpiP16-Feb-11 19:33 
GeneralRe: structure to file Pin
Niklas L16-Feb-11 21:59
Niklas L16-Feb-11 21:59 
GeneralRe: structure to file Pin
David Crow17-Feb-11 1:51
David Crow17-Feb-11 1:51 
GeneralRe: structure to file Pin
goldenrose917-Feb-11 3:01
goldenrose917-Feb-11 3:01 
QuestionRe: structure to file Pin
David Crow17-Feb-11 4:14
David Crow17-Feb-11 4:14 
AnswerRe: structure to file Pin
goldenrose917-Feb-11 4:46
goldenrose917-Feb-11 4:46 
GeneralRe: structure to file Pin
David Crow17-Feb-11 4:57
David Crow17-Feb-11 4:57 
GeneralRe: structure to file Pin
goldenrose917-Feb-11 5:08
goldenrose917-Feb-11 5:08 
GeneralRe: structure to file Pin
David Crow17-Feb-11 5:11
David Crow17-Feb-11 5:11 
GeneralRe: structure to file Pin
goldenrose917-Feb-11 5:30
goldenrose917-Feb-11 5:30 
GeneralRe: structure to file Pin
David Crow17-Feb-11 7:13
David Crow17-Feb-11 7:13 
GeneralRe: structure to file Pin
goldenrose917-Feb-11 7:17
goldenrose917-Feb-11 7:17 
AnswerRe: structure to file Pin
Alain Rist16-Feb-11 11:41
Alain Rist16-Feb-11 11:41 
GeneralRe: structure to file Pin
Richard MacCutchan16-Feb-11 21:28
mveRichard MacCutchan16-Feb-11 21:28 
AnswerRe: structure to file Pin
jk chan16-Feb-11 6:22
jk chan16-Feb-11 6:22 
GeneralRe: structure to file Pin
goldenrose916-Feb-11 7:04
goldenrose916-Feb-11 7:04 

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.