Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/src/runtime/c-libs/posix-io/write.c
ViewVC logotype

Annotation of /sml/trunk/src/runtime/c-libs/posix-io/write.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (view) (download) (as text)

1 : monnier 2 /* write.c
2 :     *
3 :     * COPYRIGHT (c) 1995 by AT&T Bell Laboratories.
4 :     */
5 :    
6 :     #include "ml-unixdep.h"
7 :     #include <unistd.h>
8 :     #include "ml-objects.h"
9 :     #include "ml-c.h"
10 :     #include "cfun-proto-list.h"
11 :    
12 :    
13 :     /* _ml_P_IO_write : (int * Word8Vector.vector * int) -> int
14 :     *
15 :     * Write the number of bytes of data from the given vector,
16 :     * starting at index 0, to the specified file. Return the
17 :     * number of bytes written. Assume bounds checks have been done.
18 :     */
19 :     ml_val_t _ml_P_IO_write (ml_state_t *msp, ml_val_t arg)
20 :     {
21 :     int fd = REC_SELINT(arg, 0);
22 :     char *data = REC_SELPTR(char, arg, 1);
23 :     size_t nbytes = REC_SELINT(arg, 2);
24 :     ssize_t n;
25 :    
26 :     n = write (fd, data, nbytes);
27 :    
28 :     CHK_RETURN (msp, n)
29 :    
30 :     } /* end of _ml_P_IO_write */

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0