Moved tests for dos.library functions into the 'dos' subdir.
[AROS.git] / rom / dos / fputs.c
blobaca591bfead2f68db9c8af1521f3b2222995b75a
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
8 #include <dos/dosextens.h>
10 #include "dos_intern.h"
12 #include <aros/debug.h>
15 /*****************************************************************************
17 NAME */
18 #include <proto/dos.h>
20 AROS_LH2(LONG, FPuts,
21 /* FPuts -- Writes a string to the specified output (buffered) */
23 /* SYNOPSIS */
24 AROS_LHA(BPTR, file, D1),
25 AROS_LHA(CONST_STRPTR, string, D2),
27 /* LOCATION */
29 struct DosLibrary *, DOSBase, 57, Dos)
31 /* FUNCTION
32 This routine writes an unformatted string to the filehandle. No
33 newline is appended to the string. This routine is buffered.
35 INPUTS
36 file - Filehandle to write to.
37 string - String to write.
39 RESULT
40 0 if all went well or EOF in case of an error.
41 IoErr() gives additional information in that case.
43 SEE ALSO
44 FGetC(), IoErr()
46 *****************************************************************************/
48 AROS_LIBFUNC_INIT
50 if (file == BNULL) {
51 SetIoErr(ERROR_OBJECT_NOT_FOUND);
52 return EOF;
55 ASSERT_VALID_PTR(BADDR(file));
56 ASSERT_VALID_PTR(string);
58 ULONG len = strlen(string);
60 return(FWriteChars(file, string, len, DOSBase) == len
61 ? 0
62 : -1);
64 AROS_LIBFUNC_EXIT
65 } /* FPuts */