You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
346 B
26 lines
346 B
4 years ago
|
/*
|
||
|
* readline.c
|
||
|
*
|
||
|
* Created on: Jun 16, 2013
|
||
|
* Author: delmadord
|
||
|
*/
|
||
|
|
||
|
#include <ctype.h>
|
||
|
#include <stdio.h>
|
||
|
#include "readline.h"
|
||
|
|
||
|
int read_line(char str[], int n) {
|
||
|
int ch, i = 0;
|
||
|
|
||
|
while (isspace(ch = getchar()))
|
||
|
;
|
||
|
while (ch != '\n' &&ch != EOF) {
|
||
|
if (i < n)
|
||
|
str[i++] = ch;
|
||
|
ch = getchar();
|
||
|
}
|
||
|
str[i] = '\0';
|
||
|
return i;
|
||
|
}
|
||
|
|