Click here to Skip to main content
15,894,106 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: System Query Pin
john563227-Dec-11 20:27
john563227-Dec-11 20:27 
GeneralRe: System Query Pin
Randor 28-Dec-11 11:08
professional Randor 28-Dec-11 11:08 
GeneralRe: System Query Pin
john563229-Dec-11 18:23
john563229-Dec-11 18:23 
GeneralRe: System Query Pin
Randor 29-Dec-11 18:47
professional Randor 29-Dec-11 18:47 
GeneralRe: System Query Pin
john563229-Dec-11 20:29
john563229-Dec-11 20:29 
GeneralRe: System Query Pin
Randor 29-Dec-11 21:57
professional Randor 29-Dec-11 21:57 
QuestionJoining 2 values with wcsncat_s Pin
jkirkerx26-Dec-11 10:52
professionaljkirkerx26-Dec-11 10:52 
AnswerRe: Joining 2 values with wcsncat_s Pin
Chris Losinger26-Dec-11 10:59
professionalChris Losinger26-Dec-11 10:59 
jkirkerx wrote:
int iNSN = wcslen(pzAddServerName)*sizeof(WCHAR);
szAddServerName = new WCHAR[iNSN+1];


should really be:

int iNSN = wcslen(pzAddServerName);
szAddServerName = new WCHAR[iNSN+1];


the 'new' operator knows the size of the type and will allocate the correct number of bytes for iNSN +1 WCHARs, behind the scenes.


jkirkerx wrote:
// one of these is not null terminated
wcsncat_s(szNewServerNames, wcslen(szNewServerNames), szAddServerName, wcslen(szAddServerName) );

then one of your wcslen_t's will cause an access violation, since wcslen is looking for the null terminator.

if one of your strings is not null-terminated, then you must know the max length allowed for it. you can use that for your length to wcnscat_s

GeneralRe: Joining 2 values with wcsncat_s Pin
jkirkerx26-Dec-11 11:13
professionaljkirkerx26-Dec-11 11:13 
QuestionNetwork Utilization Pin
john563225-Dec-11 22:13
john563225-Dec-11 22:13 
AnswerRe: Network Utilization Pin
Richard MacCutchan26-Dec-11 6:57
mveRichard MacCutchan26-Dec-11 6:57 
AnswerRe: Network Utilization Pin
Randor 26-Dec-11 12:17
professional Randor 26-Dec-11 12:17 
QuestionDetect keypress count Pin
juver escolta23-Dec-11 6:04
juver escolta23-Dec-11 6:04 
AnswerRe: Detect keypress count Pin
CPallini23-Dec-11 7:34
mveCPallini23-Dec-11 7:34 
AnswerRe: Detect keypress count Pin
Luc Pattyn24-Dec-11 2:21
sitebuilderLuc Pattyn24-Dec-11 2:21 
GeneralRe: Detect keypress count Pin
CPallini24-Dec-11 3:59
mveCPallini24-Dec-11 3:59 
AnswerRe: Detect keypress count Pin
Luc Pattyn24-Dec-11 4:06
sitebuilderLuc Pattyn24-Dec-11 4:06 
GeneralRe: Detect keypress count Pin
CPallini24-Dec-11 4:42
mveCPallini24-Dec-11 4:42 
QuestionRe: Detect keypress count Pin
David Crow23-Dec-11 9:28
David Crow23-Dec-11 9:28 
AnswerRe: Detect keypress count Pin
Gary R. Wheeler23-Dec-11 23:56
Gary R. Wheeler23-Dec-11 23:56 
AnswerRe: Detect keypress count Pin
Lactoferrin24-Dec-11 1:45
Lactoferrin24-Dec-11 1:45 
AnswerRe: Detect keypress count Pin
Software_Developer24-Dec-11 4:54
Software_Developer24-Dec-11 4:54 
QuestionHow GetObjectSchema() to work ? Pin
André Dewispelaere23-Dec-11 3:43
André Dewispelaere23-Dec-11 3:43 
AnswerRe: How GetObjectSchema() to work ? Pin
Mohibur Rashid26-Dec-11 22:13
professionalMohibur Rashid26-Dec-11 22:13 
QuestionHow to Delete A Node with its all Child in XML File ? Pin
002comp22-Dec-11 23:18
002comp22-Dec-11 23:18 

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.