[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
A simple C doubt
- To: <linuxgames@sunsite.dk>
- Subject: A simple C doubt
- From: Igor Cabral Corrêa <imortis@uol.com.br>
- Date: Wed, 20 Aug 2003 01:39:50 -0300
- Delivered-to: archiver@seul.org
- Delivered-to: mailing list linuxgames@sunsite.dk
- Delivery-date: Wed, 20 Aug 2003 00:37:12 -0400
- Mailing-list: contact linuxgames-help@sunsite.dk; run by ezmlm
- Reply-to: linuxgames@sunsite.dk
Hi people!
How can I try to read a line from stdin (in fact, a file piped into stdin) and know if the read line is empty or not?
I want to read, for example:
asdakldakl
aljdajkdja
aljkdk
How can I read these 4 lines? Using something like
for (int i=0; i<4; i++) scanf("%s", line);
the empty line will be skipped, and I don´t know that. Someone knows an easy way to do it?
PS.: I know how many lines I want to read.
[]´s
Igor Cabral Corrêa