home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!ames!agate!ucbvax!lrw.com!leichter
- From: leichter@lrw.com (Jerry Leichter)
- Newsgroups: comp.os.vms
- Subject: re: VAX c
- Message-ID: <9212282111.AA11260@uu3.psi.com>
- Date: 28 Dec 92 20:10:48 GMT
- Sender: usenet@ucbvax.BERKELEY.EDU
- Organization: The Internet
- Lines: 23
-
-
- Is there a way to get VAX C to flush the VMS file buffers?
-
- I've got a program that reads data in for the tta2: port and then
- writes it to a file. The problem is that the data doesn't get written
- to the file until the buffer is full, and that may not happen but once
- every day or two.
-
- Try the fsync() function. Usage: fsync(int fd). Returns EBADF if fd is not
- a valid file descriptor. (Note that you need a file DESCRIPTOR, not a file
- POINTER (FILE *); use fileno() to get the file descriptor from a file
- pointer.) When fsync() returns, all pending changes should be on the disk.
- (In VMS, this really means that an RMS $FLUSH was executed.)
-
- Note that if you are accessing a file using the standard I/O package (i.e.,
- through a file pointer) you must first do an fflush() to get the data out to
- the "Unix I/O" level.
-
- I'm not sure if fsync() is documented yet, but it's been in the RTL for quite
- some time; it's a BSD innovation that's been picked up by most recent Unix
- implementations.
- -- Jerry
-
-