Re: Pro*C Question

From: Bent Stigsen <ngcdo_at_thevoid.dk>
Date: Sat, 23 Oct 2004 03:47:32 +0200
Message-ID: <4179b819$0$264$edfadb0f_at_dread11.news.tele.dk>


paddy_nyr wrote:
> I'm new to Pro*C/C in general so can anyone give me some insite on where I
> might be going wrong?

Your problem has nothing to do with ProC as such, so you would probably be better of in comp.lang.c

> This is old code that I'm trying to modify.

When asking for help on a specific problem, then post a copy/paste from the original code. Transcribing is errorprone. If it needs to be cut down to something simple, then run it through a compiler first.

> Thanks
>
> int
> Test ( D_REPORT_TABLE *reqInfo
> )
>
> (
> EXEC SQL BEGIN DECLARE SECTION
>
> chat reportType[4];
>
> EXEC SQL END DECLARE SECTION;
>
> memset( &reporType, 0X00, sizeof ( reporType ));

memset( reporType, 0, 4);

> strcpy(( char * ) reporType,rTrim(reqInfo->report_code));

use "strncpy" instead.

> printf('What is in %s',reportType);
> printf('What is in %s',reqInfo->report_code);
>
> if ( *reportType == 'NS'){

use "strcmp" or "strncmp" for comparing strings.

> printf('I have an NS report ');
> };
>
> );
>
> Why do I get no output on my 1st printf statemnet, but on the
> 2nd printf I do get the result set I'm looking for? It should print the
> value 'NS'.
> Also why doesn't my if statment work?

refresh your c-skills.

/Bent Received on Sat Oct 23 2004 - 03:47:32 CEST

Original text of this message