forked from KolibriOS/kolibrios
8fa851ddb6
strtol.с - removed existing definitions; fgets.c - uses fread() to read; gets.c - added additional check; git-svn-id: svn://kolibrios.org@9081 a494cfbc-eb01-0410-851d-a64ba20cac60
19 lines
307 B
C
19 lines
307 B
C
#include <stdio.h>
|
|
#include "conio.h"
|
|
#include <errno.h>
|
|
|
|
char *fgets(char *str, int n, FILE *stream)
|
|
{
|
|
int i=0, sym_code;
|
|
|
|
if(!stream || !str){
|
|
errno = EINVAL;
|
|
return NULL;
|
|
}
|
|
|
|
i = fread(str, n-1, sizeof(char), stream);
|
|
if(i<1){ return NULL; }
|
|
return str;
|
|
}
|
|
|