-
Notifications
You must be signed in to change notification settings - Fork 0
/
stdin.c
31 lines (28 loc) · 1.19 KB
/
stdin.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* stdin.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: abenamar <abenamar@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/15 02:53:46 by abenamar #+# #+# */
/* Updated: 2023/01/17 00:01:41 by abenamar ### ########.fr */
/* */
/* ************************************************************************** */
#include "get_next_line_test.h"
int main(void)
{
char *s;
write(STDOUT_FILENO, "Type then press enter, type 'q' to exit :\n", 42);
s = NULL;
while (!s || strcmp(s, "q\n"))
{
free(s);
write(STDOUT_FILENO, "<< ", 3);
s = get_next_line(STDIN_FILENO);
printf(">> %s", s);
}
free(s);
printf("bye!\n");
return (0);
}