genericopenlibs/cstdlib/LSTDIO/FPUTC.C
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 /*
       
     2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * FUNCTION
       
    16 * <<fputc>>---write a character on a stream or file
       
    17 * INDEX
       
    18 * fputc
       
    19 * ANSI_SYNOPSIS
       
    20 * #include <stdio.h>
       
    21 * int fputc(int <[ch]>, FILE *<[fp]>);
       
    22 * TRAD_SYNOPSIS
       
    23 * #include <stdio.h>
       
    24 * int fputc(<[ch]>, <[fp]>)
       
    25 * int <[ch]>;
       
    26 * FILE *<[fp]>;
       
    27 * <<fputc>> converts the argument <[ch]> from an <<int>> to an
       
    28 * <<unsigned char>>, then writes it to the file or stream identified by
       
    29 * <[fp]>.
       
    30 * If the file was opened with append mode (or if the stream cannot
       
    31 * support positioning), then the new character goes at the end of the
       
    32 * file or stream.  Otherwise, the new character is written at the
       
    33 * current value of the position indicator, and the position indicator
       
    34 * advances by one.
       
    35 * For a macro version of this function, see <<putc>>.
       
    36 * RETURNS
       
    37 * If successful, <<fputc>> returns its argument <[ch]>.  If an error
       
    38 * intervenes, the result is <<EOF>>.  You can use `<<ferror(<[fp]>)>>' to
       
    39 * query for errors.
       
    40 * PORTABILITY
       
    41 * <<fputc>> is required by ANSI C.
       
    42 * Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
       
    43 * <<lseek>>, <<read>>, <<sbrk>>, <<write>>.
       
    44 * 
       
    45 *
       
    46 */
       
    47 
       
    48 
       
    49 
       
    50 #include <stdio.h>
       
    51 /**
       
    52 Write character to stream.
       
    53 @return If there are no errors the written character is returned.
       
    54 If an error occurs, EOF is returned.
       
    55 @param ch Character to be written. 
       
    56 The function casts the int parameter to its unsigned char equivalent before writing it. 
       
    57 @param file pointer to an open file.
       
    58 */
       
    59 EXPORT_C int
       
    60 fputc (int ch, FILE * file)
       
    61 {
       
    62   return putc ((unsigned char)ch, file);
       
    63 }