Hi everyone,
I am a newbie in C programming.
I have to make an implementation of gets() function from stdio.h, but I am not sure where to start.
Please advice, any help is welcome.
Thank you,
Brian.
Hi everyone,
I am a newbie in C programming.
I have to make an implementation of gets() function from stdio.h, but I am not sure where to start.
Please advice, any help is welcome.
Thank you,
Brian.
Use getchar() and a loop.
Though modelling fgets() would be a better idea.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
fgets() is indeed better. I don't know what you meant by not using stdio.h . I would actually be interested in seeing that.
Nah. std is for standard, io is for input/output. C all by itself does not include this, so without stdio.h you cannot access any input, and you cannot produce any output.
Programs which do not include stdio are possible, but beyond just clocking time on the processor they don't have any purpose.
ifaTreeFallsintheForest.c
Code:int main() { int i = 100; char buffer[] = "can you hear me now?"; while (i > 0) { [ do things with variables ]
Last edited by MK27; 04-10-2010 at 12:12 PM.
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge