Click here to Skip to main content
15,914,401 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Populating web based default email client fields Pin
David Crow6-Apr-06 2:39
David Crow6-Apr-06 2:39 
QuestionDLL - Write to file error Pin
borono5-Apr-06 7:38
borono5-Apr-06 7:38 
QuestionRe: DLL - Write to file error Pin
David Crow5-Apr-06 7:55
David Crow5-Apr-06 7:55 
AnswerRe: DLL - Write to file error Pin
Waldermort5-Apr-06 7:57
Waldermort5-Apr-06 7:57 
GeneralRe: DLL - Write to file error Pin
borono5-Apr-06 12:22
borono5-Apr-06 12:22 
GeneralRe: DLL - Write to file error Pin
Waldermort5-Apr-06 14:53
Waldermort5-Apr-06 14:53 
GeneralRe: DLL - Write to file error Pin
borono5-Apr-06 15:10
borono5-Apr-06 15:10 
GeneralRe: DLL - Write to file error Pin
Waldermort5-Apr-06 19:47
Waldermort5-Apr-06 19:47 
borono wrote:
am sorry, but I do not know what you meant by: "...set the memory and zero it. When you come to use it later simply test it." Can I see an example?


sure:
unsgined char *foo; // declare the variable
foo = new unsigned char [100]; // set the memory so it can hold 100 chars
ZeroMemory(foo,sizeof foo); // set the memory to all 0's

int size = strlen((char *)foo); // notice the typecast.  
// strlen is expecting a char* where'as we have an unsigned char*.

// now give it a value
strcpy((char *)foo,"Some random string"); // try copying something to it

// now test
if (!foo)
    MessageBox(0,"foo is still empty",0,0);

delete foo; // prevent memory leaking


As for your code, have you checked the size of pkt_data? You are using it as an array, but are you sure it is correctly being initialised? It's hard to see from your code since you do it in a while loop and there is no specified number of loops.

You later use if(i<7) which may be reading past the end of your array. Watch the values of i at this point. I would also put a check for the size there: if ((i<7)&&(i<strlen(pkt_data)).

If you have further problems, and if you are using VC6, I can take a look at your project.
GeneralRe: DLL - Write to file error Pin
David Crow6-Apr-06 2:45
David Crow6-Apr-06 2:45 
GeneralRe: DLL - Write to file error Pin
David Crow6-Apr-06 2:41
David Crow6-Apr-06 2:41 
GeneralRe: DLL - Write to file error Pin
borono6-Apr-06 7:57
borono6-Apr-06 7:57 
GeneralRe: DLL - Write to file error Pin
David Crow6-Apr-06 8:15
David Crow6-Apr-06 8:15 
GeneralRe: DLL - Write to file error Pin
borono6-Apr-06 12:49
borono6-Apr-06 12:49 
Questioneasy :--making an executable application: VC++7 or VC++.NET Pin
luhfluh5-Apr-06 7:08
luhfluh5-Apr-06 7:08 
AnswerRe: easy :--making an executable application: VC++7 or VC++.NET Pin
toxcct5-Apr-06 7:12
toxcct5-Apr-06 7:12 
Questionquerying registry Pin
Manu_815-Apr-06 6:58
Manu_815-Apr-06 6:58 
AnswerRe: querying registry Pin
David Crow5-Apr-06 7:01
David Crow5-Apr-06 7:01 
AnswerRe: querying registry Pin
Hamid_RT5-Apr-06 8:49
Hamid_RT5-Apr-06 8:49 
QuestionMFC: Button press and release? Pin
Rostfrei5-Apr-06 6:30
Rostfrei5-Apr-06 6:30 
AnswerRe: MFC: Button press and release? Pin
toxcct5-Apr-06 6:33
toxcct5-Apr-06 6:33 
GeneralRe: MFC: Button press and release? Pin
Rostfrei5-Apr-06 8:57
Rostfrei5-Apr-06 8:57 
AnswerRe: MFC: Button press and release? Pin
FarPointer5-Apr-06 6:34
FarPointer5-Apr-06 6:34 
GeneralRe: MFC: Button press and release? Pin
Rostfrei5-Apr-06 8:53
Rostfrei5-Apr-06 8:53 
GeneralRe: MFC: Button press and release? Pin
Waldermort5-Apr-06 8:56
Waldermort5-Apr-06 8:56 
GeneralRe: MFC: Button press and release? Pin
David Crow5-Apr-06 9:09
David Crow5-Apr-06 9:09 

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.