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!

Recommended Answers

All 2 Replies

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.