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
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