Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with Getline

Status
Not open for further replies.

zaidif

Programmer
Dec 14, 2001
2
CA
Hi,

I'm having trouble getting getline to work. Keeps giving me segmentation faults. I have made a short program to debug what I'm doing wrong. This code is also giving me segmentation faults.

Can some tell me what I'm doing wrong? Attached is the code:
#include <stdio.h>
main(){
char *cptr = (char *) malloc(sizeof(char));
getline(cptr,10,stdin);

}

Thanks in advance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top