D
David McDivitt
I need help writing a file if someone would oblige. An image is retrieved
from a database, a file opened, and one of the fields written to the file.
When writing normally, extra bytes are added to the data and the image is
not interpretable. Probably Perl is converting control characters. I tried
using sysopen and syswrite so the data would be written as is, but cannot
get the syntax right. The code is pasted here. Thanks
use Fcntl qw( O_WRONLY O_CREAT ); #placed at top of program
sysopen JPGFILE, '>'.$$cfg{'ServerSaveImagePath'}.$jpg, (O_CREAT | O_WRONLY)
or problem('Cannot create image file');
syswrite JPGFILE, $field[0];
#open JPGFILE, '>'.$$cfg{'ServerSaveImagePath'}.$jpg or problem('Cannot
create image file');
#print JPGFILE $field[0] or problem('Cannot write image file');
close JPGFILE;
from a database, a file opened, and one of the fields written to the file.
When writing normally, extra bytes are added to the data and the image is
not interpretable. Probably Perl is converting control characters. I tried
using sysopen and syswrite so the data would be written as is, but cannot
get the syntax right. The code is pasted here. Thanks
use Fcntl qw( O_WRONLY O_CREAT ); #placed at top of program
sysopen JPGFILE, '>'.$$cfg{'ServerSaveImagePath'}.$jpg, (O_CREAT | O_WRONLY)
or problem('Cannot create image file');
syswrite JPGFILE, $field[0];
#open JPGFILE, '>'.$$cfg{'ServerSaveImagePath'}.$jpg or problem('Cannot
create image file');
#print JPGFILE $field[0] or problem('Cannot write image file');
close JPGFILE;