[EMAIL PROTECTED] wrote:
> I'd like to 'glue' some string together. I'm doing it like this :
>
> #include <stdio.h>
> #include <stdlib.h>
>
> main()
> {
> char dbQuery[] = "";
This allocates precisely one byte of data for dbQuery. Try
char dbQuery[1024];
instead.
> const char DeelmonsterTabelZendvlag[] = "deelmonster_im.zendvlag";
> const char DeelmonsterTabelLabID[] = "deelmonster_im.lab_id";
> const char DeelmonsterWachttabel[] = "w_deelmonster_im";
> const char MonsterTabelPuntID[] = "monster_im.pntim_id";
> const char DeelmonsterTabelID[] = "deelmonster_im.dlmim_id";
>
> sprintf(dbQuery, "%s%s%s%s%s",
> "INSERT INTO ", DeelmonsterWachttabel,
> " (dlmim_id, pntim_id, lab_id, dat_monstername, zendvlag, geannuleerd)",
> " SELECT ", DeelmonsterTabelID);
> printf("%s\n", dbQuery);
> }
This call will overflow dbQuery. This would typically result in a
segmentation fault.
--
Glynn Clements <[EMAIL PROTECTED]>