compile problem

J

JC

when i compile my c program which use to link to a access database via ODBC

i got two warning message when i compile the c program


odbctest.c(37) : warning C4761: integral size mismatch in argument;
conversion supplied
odbctest.c(38) : warning C4761: integral size mismatch in argument;
conversion supplied

my coding are like the following
....
HSTMT hstmt;
int no;
char* szModel[128];
SDWORD cbMobel;
......
line 37: SQLBindCol(hStme, no, SQL_C_CHAR, szModel,
sizeof(szModel),&cbModel);

can anyone give me a idea? what problem on my coding.. and how to fix the
warning message.

thanks

JC
 
R

Richard Bos

JC said:
odbctest.c(37) : warning C4761: integral size mismatch in argument;
conversion supplied
odbctest.c(38) : warning C4761: integral size mismatch in argument;
conversion supplied
HSTMT hstmt;
int no;
char* szModel[128];
SDWORD cbMobel;
.....
line 37: SQLBindCol(hStme, no, SQL_C_CHAR, szModel,
sizeof(szModel),&cbModel);

I suppose line 38 is similar?

One of the arguments to SQLBindCol is of the wrong size. Since we don't
know how SQLBindCol is declared, we don't know which, but a comparison
between what that function expects and what you are actually passing it
should expose the problem.

Richard
 
T

Tim Prince

JC said:
when i compile my c program which use to link to a access database via
ODBC

i got two warning message when i compile the c program


odbctest.c(37) : warning C4761: integral size mismatch in argument;
conversion supplied
odbctest.c(38) : warning C4761: integral size mismatch in argument;
conversion supplied

my coding are like the following
...
HSTMT hstmt;
int no;
char* szModel[128];
SDWORD cbMobel;
.....
line 37: SQLBindCol(hStme, no, SQL_C_CHAR, szModel,
sizeof(szModel),&cbModel);

can anyone give me a idea? what problem on my coding.. and how to fix the
warning message.

thanks

JC
Wrong assumptions about sizeof() could do this. Did you
#include <stdlib.h>
?
 
M

Mark McIntyre

char* szModel[128];

so szModel is an array of 128 pointers to char.
line 37: SQLBindCol(hStme, no, SQL_C_CHAR, szModel,
sizeof(szModel),&cbModel);

At a guess, the 4th parameter of SQLBindCol expects something
different to an array of pointers. Most probably it expects a pointer
to an array...
can anyone give me a idea? what problem on my coding.. and how to fix the
warning message.

pass the right type. Pointers are not the same as arrays, and arrays
of pointers are not the same as pointers to arrays. .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,082
Messages
2,570,588
Members
47,209
Latest member
Ingeborg61

Latest Threads

Top