source: trunk/libs/mini-libc/stdio.h @ 455

Last change on this file since 455 was 445, checked in by alain, 6 years ago

Restructure the mini_libc.

File size: 3.4 KB
Line 
1/*
2 * stdio.h - User level <stdio> library definition.
3 *
4 * Author     Alain Greiner (2016,2017,2018)
5 *
6 * Copyright (c) UPMC Sorbonne Universites
7 *
8 * This file is part of ALMOS-MKH.
9 *
10 * ALMOS-MKH is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; version 2.0 of the License.
13 *
14 * ALMOS-MKH is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with ALMOS-MKH; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24#ifndef _STDIO_H_
25#define _STDIO_H_
26
27/*********************************************************************************************
28 * This file defines the user level, TXT related <stdio> library.
29 * These functions call the read() and write() functions defined in the <unistd> library
30 * to access the TXT terminal.
31 ********************************************************************************************/
32
33
34/*********************************************************************************************
35 * This function writes a formated string to the standard "stdout" stream.
36 *********************************************************************************************
37 * @ returns number of characters written if success / returns -1 if failure.
38 ********************************************************************************************/
39int printf( const char * format, ... );
40
41/*********************************************************************************************
42 * This function writes one single character to the standard "stdout" stream.
43 *********************************************************************************************
44 * @ returns written character code if success / returns 0 (EOF) if failure.
45 ********************************************************************************************/
46int putchar( int c );
47
48/*********************************************************************************************
49 * This function returns one single character from the standard "stdin" stream.
50 *********************************************************************************************
51 * @ returns read character code if success / returns 0 (EOF) if failure.
52 ********************************************************************************************/
53int getchar();
54
55/*********************************************************************************************
56 * This function copies a formated string to a fixed size buffer.
57 * it includes the NUL terminating character.
58 * it cheks that the formated string fit in the buffer length.
59 *********************************************************************************************
60 * @ string    : pointer on target buffer.
61 * @ length    : max bumber of characters in target buffer.
62 * @ format    : formated string.
63 * @ returns number of characters written if success / returns -1 if failure.
64 ********************************************************************************************/
65int snprintf( char         * string,
66              unsigned int   length,
67              const char   * format, ... );
68
69#endif  // _STDIO_H_
Note: See TracBrowser for help on using the repository browser.