[439] | 1 | /* |
---|
[445] | 2 | * stdio.h - User level <stdio> library definition. |
---|
[439] | 3 | * |
---|
[445] | 4 | * Author Alain Greiner (2016,2017,2018) |
---|
[439] | 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 | |
---|
[445] | 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 | ********************************************************************************************/ |
---|
[439] | 32 | |
---|
[445] | 33 | |
---|
[444] | 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 | ********************************************************************************************/ |
---|
| 39 | int printf( const char * format, ... ); |
---|
[439] | 40 | |
---|
[444] | 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 | ********************************************************************************************/ |
---|
| 46 | int putchar( int c ); |
---|
[439] | 47 | |
---|
[444] | 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 | ********************************************************************************************/ |
---|
| 53 | int getchar(); |
---|
[439] | 54 | |
---|
[444] | 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 | ********************************************************************************************* |
---|
[445] | 60 | * @ string : pointer on target buffer. |
---|
[444] | 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 | ********************************************************************************************/ |
---|
| 65 | int snprintf( char * string, |
---|
| 66 | unsigned int length, |
---|
| 67 | const char * format, ... ); |
---|
[439] | 68 | |
---|
| 69 | #endif // _STDIO_H_ |
---|