|
|
Archives of the TeradataForum
Message Posted: Fri, 28 Mar 2003 @ 16:31:25 GMT
Subj: | | Re: Question: Extract OUTMOD |
|
From: | | Anomy Anom |
<-- Anonymously Posted: Friday, March 28, 2003 10:58 -->
Would this work? Not the cleanest C programming but it gets the point across.
case 3:
/* Process data */
Record_Size=*resplen;
File_Size=Record_Size+1; /* need newline character added
to end for UNIX */
*resplen = 0;
/* create the output file */
memcpy(out_dtl_ptr->FIELD1,resprec->FIELD1, Record_Size);
out_dtl_ptr->FIELD1[Record_Size] = '\n';
int i = 2;
char clean [2049];
while(out_dtl_ptr->FIELD1[i] != '\n')
{
clean[i-2] = out_dtl_ptr->FIELD1[i];
i++;
}
clean[i] = '\n';
/* Write output record to disk */
/* Not sure of fwrite() as it appears to require a pointer */
if ( fwrite(clean,File_Size,1,file1_fp)
!= NUM_OF_RCDS_WRITTEN )
{
fprintf(stderr,"%s %d:Bad Write on file <%s>,errno=%d\n",
__FILE__,__LINE__,fname,errno);
perror(fname);
fflush(stderr);
dw_kill_parnt_child();
exit(BAD_WRITE);
}
tot_record_ctr++;
break;
| |