* problems with setvbuf
@ 1996-08-15 4:00 Dirk Pansegrau
0 siblings, 0 replies; only message in thread
From: Dirk Pansegrau @ 1996-08-15 4:00 UTC (permalink / raw)
In order to write data to tape buffered with 32K we used
#include <stdio.h>
char buf[32768],data[32768];
FILE *fp;
main()
{
fp=fopen("/dev/nrmt0h","w");
setvbuf(fp,buf,_IOFBF,sizeof(buf));
fwrite(data,1,sizeof(data),fp);
fclose(fp);
}
trace-output of write:
a.out
Tracing process /proc/1044
4
..
getdtablesize () = 4096
write (4, 0x140000230, 32768) = 32768
..
exit (0) = (0)
EXIT [status=0]
When we tried to read in the data with a corresponding routine (fread), we
found out, that the length of the buffer read from tape was 32K-16Byte=32752
Byte.
trace-output of read:
a.out
Tracing process /proc/1083
4
..
getdtablesize () = 4096
read (4, 0x40000238, 32752) = 32752 [, 0x140000238, ]
read (4, 0x40000238, 32752) = 16 [, 0x140000238, ]
..
exit (0) = (0)
EXIT [status=0]
The read and write system calls cannot be used directly because output has to
be buffered.
Any suggestions to solve this problem would be greatly appreciated.
Thanks
Dirk Pansegrau
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1996-08-15 4:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-08-15 4:00 problems with setvbuf Dirk Pansegrau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox