Click here to Skip to main content
15,917,991 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: memset() run time error Pin
CPallini21-Nov-11 2:44
mveCPallini21-Nov-11 2:44 
AnswerRe: memset() run time error Pin
manju 321-Nov-11 18:30
manju 321-Nov-11 18:30 
GeneralRe: memset() run time error Pin
CPallini21-Nov-11 20:06
mveCPallini21-Nov-11 20:06 
AnswerRe: memset() run time error Pin
Chuck O'Toole21-Nov-11 3:52
Chuck O'Toole21-Nov-11 3:52 
GeneralRe: memset() run time error Pin
Erudite_Eric21-Nov-11 23:10
Erudite_Eric21-Nov-11 23:10 
AnswerRe: memset() run time error Pin
Stefan_Lang21-Nov-11 5:39
Stefan_Lang21-Nov-11 5:39 
GeneralRe: memset() run time error Pin
manju 321-Nov-11 18:31
manju 321-Nov-11 18:31 
GeneralRe: memset() run time error Pin
Stefan_Lang21-Nov-11 22:37
Stefan_Lang21-Nov-11 22:37 
Easy: don't call memset!

Two possibilities:

1. if you don't use pShardedBuffer2 outside this function, then (a) declare it inside the function as a local parameter and (b) don't malloc, and don't memset (in this case I really don't know what you do that for)

2. if you do use it elsewhere, then you must copy the data, not the pointer! You should be aware though, that changes to that copy won't affect the original data, you can use that copy only to read from! Anyway, if you copy data to your buffer, memset is not required - the value you set your buffer to gets overwritten anyway!

Note that I have no idea how to go about copying the data, as MapViewOfFile returns a HANDLE, not a string, and does not provide any information about the structure or size of that data. Accessing it like a string sounds like calling for trouble, especially if there are 0 bytes within. I'm not familiar with this function or the data structure it delivers, but I suggest you read up on it and how to use it properly.

What you need to do may also depend on how you use the data later, such as in your call to addMsg1(). What does it do?
QuestionCIPAddressCtrl background color Pin
Benjamin Bruno21-Nov-11 0:48
Benjamin Bruno21-Nov-11 0:48 
AnswerRe: CIPAddressCtrl background color Pin
Randor 21-Nov-11 3:22
professional Randor 21-Nov-11 3:22 
AnswerRe: CIPAddressCtrl background color Pin
Satheesh154621-Nov-11 17:40
Satheesh154621-Nov-11 17:40 
Questionstring operation Pin
robin70020-Nov-11 19:21
robin70020-Nov-11 19:21 
AnswerRe: string operation Pin
«_Superman_»20-Nov-11 21:52
professional«_Superman_»20-Nov-11 21:52 
AnswerRe: string operation Pin
vr99999999921-Nov-11 1:53
vr99999999921-Nov-11 1:53 
QuestionRe: string operation Pin
David Crow21-Nov-11 2:06
David Crow21-Nov-11 2:06 
QuestionRe: string operation Pin
CPallini21-Nov-11 2:07
mveCPallini21-Nov-11 2:07 
Questioncompare character array with file in C Pin
robin70020-Nov-11 17:15
robin70020-Nov-11 17:15 
AnswerRe: compare character array with file in C Pin
«_Superman_»20-Nov-11 17:28
professional«_Superman_»20-Nov-11 17:28 
QuestionRe: compare character array with file in C Pin
David Crow20-Nov-11 17:29
David Crow20-Nov-11 17:29 
AnswerRe: compare character array with file in C Pin
robin70020-Nov-11 18:29
robin70020-Nov-11 18:29 
QuestionHow to find the most frequent value of string array, and how many Pin
sadas232341s20-Nov-11 2:58
sadas232341s20-Nov-11 2:58 
AnswerRe: How to find the most frequent value of string array, and how many Pin
Chris Losinger20-Nov-11 4:04
professionalChris Losinger20-Nov-11 4:04 
GeneralRe: How to find the most frequent value of string array, and how many Pin
sadas232341s20-Nov-11 6:26
sadas232341s20-Nov-11 6:26 
GeneralRe: How to find the most frequent value of string array, and how many Pin
Chris Losinger20-Nov-11 6:35
professionalChris Losinger20-Nov-11 6:35 
GeneralRe: How to find the most frequent value of string array, and how many Pin
sadas232341s20-Nov-11 7:03
sadas232341s20-Nov-11 7:03 

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.