Click here to Skip to main content
16,006,378 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalplease help Pin
swatgodjr23-Nov-04 8:28
swatgodjr23-Nov-04 8:28 
GeneralRe: please help Pin
David Crow23-Nov-04 9:18
David Crow23-Nov-04 9:18 
GeneralRe: please help Pin
Swatgod23-Nov-04 19:25
Swatgod23-Nov-04 19:25 
GeneralRe: please help Pin
David Crow1-Dec-04 2:35
David Crow1-Dec-04 2:35 
GeneralRe: please help Pin
Swatgod1-Dec-04 9:42
Swatgod1-Dec-04 9:42 
GeneralRe: please help Pin
David Crow1-Dec-04 9:49
David Crow1-Dec-04 9:49 
GeneralRe: please help Pin
Swatgod2-Dec-04 8:28
Swatgod2-Dec-04 8:28 
GeneralRe: please help Pin
David Crow2-Dec-04 8:41
David Crow2-Dec-04 8:41 
Swatgod wrote:
extern "C" __declspec(dllexport) firstn()
{
char first[10];

printf(" What is your first name: ");
scanf(" %s", first);

return (char)first;
}


The first variable goes away once firstn() loses scope. Therefore, the return statement, in its current form, is useless. Since no return type was specified, int is assumed. This conflicts with first being cast to a char.

The same holds true for the lastn() function.

Swatgod wrote:
extern "C" __declspec(dllexport) firstlast(char first, char last)
{
printf(" your first and last name is %s %s.", first, last);

return 0;
}


The first and last variables are of type char, but you are treating them as null-terminated strings in the call to printf(). This is a sure-fire recipe for stack corruption.

Also, the prototypes near the top are not necessary.


"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow


GeneralRe: please help Pin
Swatgod3-Dec-04 0:31
Swatgod3-Dec-04 0:31 
GeneralRe: please help Pin
David Crow3-Dec-04 3:04
David Crow3-Dec-04 3:04 
GeneralRe: please help Pin
swatgodjr29-Nov-04 6:19
swatgodjr29-Nov-04 6:19 
GeneralUsing MFC With C++ Pin
BRIMID23-Nov-04 8:09
BRIMID23-Nov-04 8:09 
GeneralRe: Using MFC With C++ Pin
toxcct23-Nov-04 8:14
toxcct23-Nov-04 8:14 
GeneralRe: Using MFC With C++ Pin
BRIMID23-Nov-04 8:24
BRIMID23-Nov-04 8:24 
GeneralRe: Using MFC With C++ Pin
act_x23-Nov-04 9:00
act_x23-Nov-04 9:00 
GeneralRe: Using MFC With C++ Pin
BRIMID23-Nov-04 9:16
BRIMID23-Nov-04 9:16 
GeneralRe: Using MFC With C++ Pin
toxcct23-Nov-04 21:31
toxcct23-Nov-04 21:31 
GeneralRe: Using MFC With C++ Pin
David Crow23-Nov-04 9:18
David Crow23-Nov-04 9:18 
GeneralA strange error with CreateThread Pin
lillah23-Nov-04 7:17
lillah23-Nov-04 7:17 
GeneralRe: A strange error with CreateThread Pin
gamitech23-Nov-04 7:47
gamitech23-Nov-04 7:47 
GeneralRe: A strange error with CreateThread Pin
Blake Miller23-Nov-04 9:08
Blake Miller23-Nov-04 9:08 
Generaltraits? still don't get it Pin
...---...23-Nov-04 6:35
...---...23-Nov-04 6:35 
GeneralRe: traits? still don't get it Pin
Joaquín M López Muñoz23-Nov-04 10:33
Joaquín M López Muñoz23-Nov-04 10:33 
GeneralRe: traits? still don't get it Pin
...---...24-Nov-04 10:17
...---...24-Nov-04 10:17 
GeneralMimicking system tray Pin
Diarrhio23-Nov-04 6:34
Diarrhio23-Nov-04 6:34 

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.