Basic Pro*C problem

From: Mark Styles <mcgill_at_lambic.co.uk>
Date: Wed, 12 Sep 2001 15:56:59 GMT
Message-ID: <p81vpt4vi7upcndf22ad1ccl3b6iphkk4t_at_4ax.com>


[Quoted] [Quoted] Apologies if this is a simple error, my Pro*C is very rusty. The following piece of code is very simple, it compiles fine, but at runtime it causes a core dump at the CONNECT point, can anyone explain why?

Here is the code:

#include <stdio.h>

EXEC SQL BEGIN DECLARE SECTION;
   VARCHAR username[32];
EXEC SQL END DECLARE SECTION; EXEC SQL INCLUDE SQLCA; int main(int argc, char*argv[])
{

   strcpy(username.arr, argv[1]);
   username.len = strlen(username.arr);

   printf("connecting...\n");
/* dumps core here */

   EXEC SQL CONNECT :username;
   printf("connected\n");
}

Mark Styles
FISTT Oracle Developer Received on Wed Sep 12 2001 - 17:56:59 CEST

Original text of this message