1 /* $Id: write.c,v 1.3 2002/03/21 22:46:30 hyperion Exp $
4 * COPYRIGHT: See COPYING in the top level directory
5 * PROJECT: ReactOS POSIX+ Subsystem
6 * FILE: subsys/psx/lib/psxdll/unistd/write.c
7 * PURPOSE: Write on a file
8 * PROGRAMMER: KJK::Hyperion <noog@libero.it>
11 * 21/03/2002: Implemented write() (KJK::Hyperion <noog@libero.it>)
14 #include <ddk/ntddk.h>
17 #include <sys/types.h>
18 #include <psx/debug.h>
19 #include <psx/errno.h>
20 #include <psx/fdtable.h>
22 ssize_t
write(int fildes
, const void *buf
, size_t nbyte
)
24 __fildes_t fdDescriptor
;
26 IO_STATUS_BLOCK isbStatus
;
31 if(fcntl(fildes
, F_GETALL
, &fdDescriptor
) == -1)
34 if((fdDescriptor
.OpenFlags
&& O_APPEND
) == O_APPEND
)
36 TODO("move file pointer to the end");
39 nErrCode
= NtWriteFile
41 fdDescriptor
.FileHandle
,
52 if(!NT_SUCCESS(nErrCode
))
54 errno
= __status_to_errno(nErrCode
);
58 return (isbStatus
.Information
);