0

Maybe my question is odd, or maybe already answered, but i didn't knew another way of searching a solution (the title i selected may get an idea of how weird is it)

Its quite simple, i'm creating an application that has a command prompt, this is, like ms-dos the C:\>_ , for this, my guess is by using a puts and a fgets (for not bufferoverflow my array) like this:

puts("SHELL>");
fgets(buffer,MAX_INPUT_LENGTH,stdin);

but this snippet throws me this on my console:

SHELL>
_

In the past time, i've been used terminal libraries like the infamous conio.h in turboc, but now i'm using gnu cc, and i don't know how to do this in C.

In C++ i may do this by using cout && cin

sorry if this looks like a dumb question, and thanks for the help!

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by InfernalDrake
0

puts() adds the '\n' to the end of the string. call printf() instead printf("SHELL>"); >>In the past time, i've been used terminal libraries like the infamous conio.h in turboc
That is what you get for learning ancient and obsolete version of C compilers. They teach you very bad habits that are sometimes difficult to unlearn.

0

I know... i haven't needed to program a command prompt since... i've also been used the curses.h but i guess it's not necesary to use a advanced terminal API

Thanks for the help

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.