#Quick question using fgets

17 messages · Page 1 of 1 (latest)

surreal epoch
#

How would you use fgets, i am getting an error message using this.

forest hareBOT
#

@surreal epoch

Screenshots!

Your message appears to contain screenshots but no code. Please send code and error messages in text instead of screenshots if applicable!

#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

fallow grove
#

Can you give us both the source code as well as the command you are using to compile your code?

surreal epoch
fallow grove
#

why do you have the
test_fget.c: In Function 'main':
at the top of the file?

surreal epoch
#

to be used as a pointer.

#

am i just suppose to remove it

rich vigil
#

dont use scanf at all.. use fgets() all the way

fallow grove
#

It is not valid C code
Either comment it out (put // at the start of the line), or remove it

rich vigil
#

it is easy to convert the string into integer with atoi()

#

use fgets() & atoi() instead of scanf()

#

your code breaks because scanf() is tricky

#

also what he says

surreal epoch
#

i just declared it as a comment and seems to work fine

#

thanks guys

#

!solved