Subversion Repositories Kolibri OS

Rev

Rev 8622 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8622 Rev 8624
Line 1... Line 1...
1
#include 
1
#include 
-
 
2
#include 
-
 
3
#include 
Line 2... Line 4...
2
 
4
 
3
int fputc(int sym, FILE *stream)
5
int fputc(int c, FILE *stream)
-
 
6
{
-
 
7
    unsigned bytes_written;
-
 
8
 
-
 
9
	unsigned status = _ksys_file_write_file(stream->name, stream->position, 1, &c, &bytes_written);
-
 
10
	
-
 
11
	if (status != _KOS_FS_ERR_SUCCESS) {
-
 
12
        switch (status) {
-
 
13
            case _KOS_FS_ERR_1:
-
 
14
            case _KOS_FS_ERR_2:
-
 
15
            case _KOS_FS_ERR_3:
-
 
16
            case _KOS_FS_ERR_4:
-
 
17
            case _KOS_FS_ERR_5:
-
 
18
            case _KOS_FS_ERR_EOF:
-
 
19
            case _KOS_FS_ERR_7:
-
 
20
            case _KOS_FS_ERR_8:
-
 
21
            case _KOS_FS_ERR_9:
-
 
22
            case _KOS_FS_ERR_10:
-
 
23
            case _KOS_FS_ERR_11:
-
 
24
            default:
-
 
25
                // Just some IO error, who knows what exactly happened
4
{
26
                errno = EIO;
-
 
27
                stream->error = errno;
-
 
28
                break;
5
    if(!fwrite(&sym, sizeof(char), 1, stream)){
29
        }
6
        return EOF;
30
        return EOF;
-
 
31
    }
-
 
32
 
7
    }
33
    stream->position++;
8
    return sym;
34
    return c;
9
}
35
}