Equivalent of gets() or scanf() ??

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
fbudek
Posts: 7
Joined: Sat Aug 04, 2012 2:43 pm

Equivalent of gets() or scanf() ??

Post 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 :D

(btw: I read somewhere you need to use inportb() on port 60, but I have no idea what to do from there :3 )
Current Project:
Unnamed OS (5% complete)
User avatar
xenos
Member
Member
Posts: 1121
Joined: Thu Aug 11, 2005 11:00 pm
Libera.chat IRC: xenos1984
Location: Tartu, Estonia
Contact:

Re: Equivalent of gets() or scanf() ??

Post by xenos »

Hint: You need a keyboard driver.
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
User avatar
serviper
Member
Member
Posts: 31
Joined: Sat Jul 16, 2011 6:05 am
Location: China
Contact:

Re: Equivalent of gets() or scanf() ??

Post by serviper »

You may need a keyboard driver or some network / serial port support.
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Equivalent of gets() or scanf() ??

Post by Love4Boobies »

If you're asking for gets, then you don't know C. So how can you write a kernel in it?
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
Kazinsal
Member
Member
Posts: 559
Joined: Wed Jul 13, 2011 7:38 pm
Libera.chat IRC: Kazinsal
Location: Vancouver
Contact:

Re: Equivalent of gets() or scanf() ??

Post 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.
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: Equivalent of gets() or scanf() ??

Post 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
Post Reply