V
vasu_7799
Hi,
I have 2 structure.
struct a
{
char cn[14+1];
char tl[5+1];
char roup[3+1];
char rc[6+1];
char adj[13+1];
char qty[13+1];
char cr[1];
} abrec;
EXEC SQL BEGIN DECLARE SECTION;
struct a_data
{
char cn[14];
char tl[5];
char roup[3];
char rc[6];
char adj[13];
char qty[13];
} abdata;
EXEC SQL END DECLARE SECTION;
There is a function getting data from database and write into the
file. A few lines from this function,
::::::
memcpy ( abrec.adj, abdata.adj, 13);
memcpy ( abrec.cr, "\n", 1);
Then, I have
if ( fwrite ( &abrec, sizeof(abrec), 1, fp1 ) != 1 )
{
fprintf ( stderr, "ERROR: Could not write cob_adjd_rec!
\n" );
fflush(stderr);
exit(-1);
}
Here, fwrite is giving me segmentation fault. More details (using
debugger)
(dbx) run
Running: pm
(process id 11523)
t@1 (l@1) signal SEGV (no mapping at the fault address) in fwrite at
0xfe613e88
0xfe613e88: fwrite+0x0018: ld [%i3 + 12], %o1
Current function is write_ub92_cob_adjd_rec
2986 if ( fwrite ( &abrec, sizeof(abrec), 1, fp1 ) != 1 )
(dbx)
Can anyone help me with this.....???? Please
Thank you
vasu
I have 2 structure.
struct a
{
char cn[14+1];
char tl[5+1];
char roup[3+1];
char rc[6+1];
char adj[13+1];
char qty[13+1];
char cr[1];
} abrec;
EXEC SQL BEGIN DECLARE SECTION;
struct a_data
{
char cn[14];
char tl[5];
char roup[3];
char rc[6];
char adj[13];
char qty[13];
} abdata;
EXEC SQL END DECLARE SECTION;
There is a function getting data from database and write into the
file. A few lines from this function,
::::::
memcpy ( abrec.adj, abdata.adj, 13);
memcpy ( abrec.cr, "\n", 1);
Then, I have
if ( fwrite ( &abrec, sizeof(abrec), 1, fp1 ) != 1 )
{
fprintf ( stderr, "ERROR: Could not write cob_adjd_rec!
\n" );
fflush(stderr);
exit(-1);
}
Here, fwrite is giving me segmentation fault. More details (using
debugger)
(dbx) run
Running: pm
(process id 11523)
t@1 (l@1) signal SEGV (no mapping at the fault address) in fwrite at
0xfe613e88
0xfe613e88: fwrite+0x0018: ld [%i3 + 12], %o1
Current function is write_ub92_cob_adjd_rec
2986 if ( fwrite ( &abrec, sizeof(abrec), 1, fp1 ) != 1 )
(dbx)
Can anyone help me with this.....???? Please
Thank you
vasu