Page 1 of 1
Equivalent of gets() or scanf() ??
Posted: Sat Aug 04, 2012 2:48 pm
by fbudek
I am making an OS and I have now finished making the bootloader and kernel. I have a working print() function and cls() function. I also have inportb() and outportb(), but I do not know how I would use these to get input from a user
The kernel is written in C, any help is appreciated
(btw: I read somewhere you need to use inportb() on port 60, but I have no idea what to do from there :3 )
Re: Equivalent of gets() or scanf() ??
Posted: Sat Aug 04, 2012 3:04 pm
by Nessphoro
Re: Equivalent of gets() or scanf() ??
Posted: Sat Aug 04, 2012 3:46 pm
by xenos
Hint: You need a keyboard driver.
Re: Equivalent of gets() or scanf() ??
Posted: Sat Aug 04, 2012 8:27 pm
by serviper
You may need a keyboard driver or some network / serial port support.
Re: Equivalent of gets() or scanf() ??
Posted: Sun Aug 05, 2012 2:06 am
by Love4Boobies
If you're asking for gets, then you don't know C. So how can you write a kernel in it?
Re: Equivalent of gets() or scanf() ??
Posted: Mon Aug 06, 2012 2:33 am
by Kazinsal
Love4Boobies wrote:If you're asking for gets, then you don't know C. So how can you write a kernel in it?
This. gets() is probably one of the more insecure functions in the C standard library. Not to mention that it's deprecated in C99 and outright obsoleted (as in it may not even exist in some C standard library implementations) in C11. It's probably not a good idea to be writing an operating system kernel if you're used to using such hilariously broken libc functions.
Re: Equivalent of gets() or scanf() ??
Posted: Mon Aug 06, 2012 7:03 am
by Owen
Blacklight wrote:outright obsoleted (as in it may not even exist in some C standard library implementations) in C11
Every libc that I know of which has a "C11" mode removes gets in it