I'm trying to make a brief header function for getline() (called "linein") so that I can go:
Code:
char *line;
line = linein();
Only I would like to include the stream, so instead the second line could be:
Code:
line=linein("stdin");
This is what the function I wrote looks like:
Code:
char *linein (char *stream) {
int len=0;
char *line;
line = NULL;
getline(&line,&len,&stream);
return line;
}
This compiles fine and actually runs, but the line returned contains nothing (nor does it test as "== NULL").
The problem is obviously to do with passing a "stream" argument to getline. Is there a proper way?