Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Violation

Status
Not open for further replies.

simmeone

Programmer
Mar 16, 2000
29
DE
Hi,

hmmmm ... so my english is so bad, but I try to explane my problem.

-------------------------------

I have write a console application in C++ and I want to import the functions in a Windows App. (I use Win32 API).

The following function works absolute correct in the console but don't works under Win32 API:

void LISTING::list ( char *f_name, char *l_name, char *strt, char *city )
{
if ( first == NULL )
{
first = new usersmatch;
last = first;
}
else
{
last->next = new usersmatch; //here comes the Access Violation from Windows
last = last->next;
}

strcpy ( last->firstname, f_name );
strcpy ( last->lastname, l_name );
strcpy ( last->street, strt );
strcpy ( last->city, city );

last->next = NULL;
}

With the following code I read the user-inputs from a Dialog-Window:

GetDlgItemText ( hwnd, IDC_MAIN_NAME, firstname, sizeof ( firstname ));
func.list ( firstname, ... );

And then, come a big ERROR, but I don't know, what I make wrong ...

Have anybody some ideas ?

ThX for helping

SiM
[sig][/sig]
 
Sorry I forgot somethink;

here is my class-structure:

----------------------------------

class LISTING
{
struct usermatch
{
char firstname[20];
char lastname[20];
char street[20];
char city[20];

usermatch *next;
} *first, *last;

public:

listing ( );
void list ( char *, char *, char *, char * );
}

Greeting SiM [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top