alternativa wrote:
thanks a lot, now I have a new problem.. I wish to pass this
string to a field of a structure. For other fields - containing
numbers - I used something like this:
Consider using my ggets function to input the string. Available
at: <http://cbfalconer.home.att.net/download/ggets.zip>
Then you can:
struct thing {
....
char *wantedstring;
....
} thething;
.....
if (0 != ggets(&thething.wantedstring)) failure();
else {
donesocarryon();
}
or, if you need to access some file f other than stdin:
if (0 != fggets(&thething.wantedstring, f)) failure();
else {
donesocarryon();
}
Note that you pass ggets the address of a pointer to char. When
done with it don't abandon it, you should free it:
free(thething.wantedstring);
thething.wantedstring = NULL;
--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>