|
-
Jun 28th, 2002, 11:48 AM
#1
The #define line create a macro - the compiler substitutes a variable for trhe letter 'y'
zout(p) becomes memset(p,0x00,sizeof(p))
I compiled and ran the code with ansi C. Which means it works in VC++. Check the visual studio docset for _qsort as well as qsort. MS sometimes does stuff like that.
qsort is part of the standard C library, and is defined as part of the ANSI standard for C and C++. If you're getting an exception, you may just copied and pasted my code. Make TOTALLY sure that the struct I used matches what you used.
You are likely running afoul of BSTR strings. That's what VB writes out to disk.
Everything you wrote to disk as a string is this in C++:
long, followed by char *.
Try this:
typedef struct patient
{
long blah;
char Lname[16];
long blah1;
char Fname[12];
char Mname;
long blah2;
char Bdate[10];
long blah3;
char Ndate[10];
int Upc;
}p;
Or change it to use BSTR
typedef struct patient
{
BSTR Lname;
BSTR Fname;
char Mname;
BSTR Bdate;
BSTR Ndate;
int Upc;
}p;
Plus, you will have to use different string operators in the compare function.
This latter choice is better for C++.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|