Re: reading a line through scanf
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Thu, 30 Jun 2005 17:41:14 GMT
gyan wrote:
>
> I want to read a line with white spaces though scanf.
> So i used:
> scanf("%['/n']",string);
>
> above is working in one program, but in other..what may be the
> reason?
Why bother - scanf is not easy to handle. If you want a complete
line, get a complete line. fgets is one was. gets is not (never
use it). Another possibility is my ggets, which is also written in
portable standard c, has the simplicity of gets together with the
complete safety (although you do have to remember to free the line
storage when you are done with it). See:
<http://cbfalconer.home.att.net/download/ggets.zip>
--
Chuck F (cbfalconer@xxxxxxxxx) (cbfalconer@xxxxxxxxxxxxxxxx)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
.
- References:
- reading a line through scanf
- From: gyan
- reading a line through scanf
- Prev by Date: Re: Floatin point issues
- Next by Date: Re: why use -> (not .) with pointers?
- Previous by thread: Re: reading a line through scanf
- Next by thread: #defines and strings
- Index(es):
Relevant Pages
|