Re: VARCHAR and strcpy compiler warnings

From: <ps_at_netvigator.com>
Date: 1996/07/06
Message-ID: <4rkqpc$2o3_at_imsp003.netvigator.com>#1/1


> Bill Jones <wjones14_at_csc.com> writes:
> Anyone know how to eliminate the compiler warnings you get when trying to
> compile a Pro*C program that have to do with VARCHAR declarations? Like
> in sample7.pc:
>
> VARCHAR sqlstmt[400];
>
> strcpy(sqlstmt.arr,"SELECT field from table");
>
>
> --
> Bill Jones e-mail addresses:
> Computer Sciences Corp. (work) wjones14_at_csc.com
> Norwich, Connecticut (play) billj_at_mindport.net
> (203) 823-2168
>
>
>>>>

What is the warning? It's very difficult to deduce the error from just the source.

BTW, I know that some Pro*C pre-compiler translate the ".arr" as the record reference of the VARCHAR record. Since VARCHAR translated as a record, copying a char string to a record in C could generate a warning. So try casting the sqlstmt.arr as (char*).

i.e. strcpy((char*)sqlstmt.arr, "SELECT field from table");

P.S.

~~~~~ ~~~~~~~~~~~ ~~~~~~~~~~~~ ~~~~~ ~~~~~~~~~~~~~~~~~~ ~~~~~~ ~~~~~~~~~
 ~~ Life is always Hard ~~~~~~~~~ ~~~~~~ ~~~~~ ¥Í¬¡±q¤£»´ÃP ~~~~~~ ~~~~~~~
  ~~~ Love is never Smooth ~~ ~~~~~~~~~~~~~ ~~~~ ·R±¡§ó«D©Z³~ ~~~~~~~~~~~~~~
   ~~~~ Always Love hard and never Life smooth ~~~ °ß¦³¼ö¤Á¦a·R,Åý¥Í©R§óºëªö ~
    ~~~~~~~~ ~~~~~ ~~~ ~~~~~~~~~~~~~~~ ~~~~ ~~~~~~~~~~~~ ~~~~~~~~~~~~~~ 
~~~~~~~~
     ~~~~ ~~~~~~~~~~~~~~~~~~~~~ ~~ ~~~~~~~~~~~ ~~~~~~~~ ~~~~~~~ ~~~ P.S. ~~~~~
                                                      ~~~~ ~~~~~~~~~~ ~~~~~~
Received on Sat Jul 06 1996 - 00:00:00 CEST

Original text of this message