Re: [LIP] Query:tcsetattr on disk file descriptor and free function issue.
Binand Sethumadhavan <[email protected]>
| Newsgroups | gmane.user-groups.linux.india.programmers |
|---|---|
| Message-ID | <[email protected]> |
On Sun, Jan 18, 2004 at 10:57:48PM -0800, Shehjar Tikoo wrote:
> 1. Can I use the tcXXXattr functions to get and set
> the attributes of the file descriptor to ICANON so
> that a read on this file descriptor returns only a
> single line? Something like what fgets does for
> standard io.
It is probably easier and more portable to just call fdopen() on your
descriptor and use fgets() itself.
> Should'nt the fprintf statement below cause a
> segmentation fault:
>
> freepthead(head);
> fprintf(stdout,"%s\n",head->path);
Not necessarily. OTOH, if your freepthead() function were like:
free(head);
head = NULL;
then this will certainly dump core ("Dereferencing a null pointer").
Binand
--
Linux - It is now safe to power ON your computer.
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn