why i could only read one charactor? [modified]
-
hello, everyone: i am now in trouble with the code below: char temp[256]; LONG cbData=80; RegOpenKeyEx(...&hKey); RegQueryValue(hKey,NULL,(LPTSTR)temp,&cbData); strcat(temp,"\\abc"); with the last line above , i could only retrieve the first charactor in temp,and the result is just *\abc. I am confused....is there anyone could help me?Thanks in advance~
modified on Monday, June 2, 2008 12:32 AM
-
hello, everyone: i am now in trouble with the code below: char temp[256]; LONG cbData=80; RegOpenKeyEx(...&hKey); RegQueryValue(hKey,NULL,(LPTSTR)temp,&cbData); strcat(temp,"\\abc"); with the last line above , i could only retrieve the first charactor in temp,and the result is just *\abc. I am confused....is there anyone could help me?Thanks in advance~
modified on Monday, June 2, 2008 12:32 AM
steven_wong wrote:
strcat(tem,"\\abc");
tem
ortemp
? Just a typo while framing the question or some other temporary variable? Regards, Jijo._____________________________________________________ http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.
-
steven_wong wrote:
strcat(tem,"\\abc");
tem
ortemp
? Just a typo while framing the question or some other temporary variable? Regards, Jijo._____________________________________________________ http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.
temp,i am sorry ;P
-
hello, everyone: i am now in trouble with the code below: char temp[256]; LONG cbData=80; RegOpenKeyEx(...&hKey); RegQueryValue(hKey,NULL,(LPTSTR)temp,&cbData); strcat(temp,"\\abc"); with the last line above , i could only retrieve the first charactor in temp,and the result is just *\abc. I am confused....is there anyone could help me?Thanks in advance~
modified on Monday, June 2, 2008 12:32 AM
MSDN says:
RegQueryValue
is provided only for compatibility with 16-bit versions of Windows. Applications should use theRegQueryValueEx
function. Besides that, what do you mean by:LONG cbData = 80
? How do you know that this would be enough?RegQueryValueEx
returns ERROR_SUCCESS if successful. Did you check the return value of the function?Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
MSDN says:
RegQueryValue
is provided only for compatibility with 16-bit versions of Windows. Applications should use theRegQueryValueEx
function. Besides that, what do you mean by:LONG cbData = 80
? How do you know that this would be enough?RegQueryValueEx
returns ERROR_SUCCESS if successful. Did you check the return value of the function?Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
thank u for ur replying, Rajesh ;) i c that,however, now i need to read the default value of a registry key, which means i could only use RegQueryValue. and i have checked if RegQueryValue returns ERROR_SUCCESS in my own codes.the codes i paste here is just for simple.anyway, thank u for ur reminding