User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 391,584 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,650 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser:
Views: 178 | Replies: 2
Reply
Join Date: May 2008
Posts: 6
Reputation: InfernalDrake is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
InfernalDrake InfernalDrake is offline Offline
Newbie Poster

Reading a string buffer at the same "output line" as a previous text label

  #1  
May 14th, 2008
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:

  1. puts("SHELL>");
  2. 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!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 10,543
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 36
Solved Threads: 860
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is online now Online
Most Valuable Poster

Re: Reading a string buffer at the same "output line" as a previous text label

  #2  
May 14th, 2008
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.
Last edited by Ancient Dragon : May 14th, 2008 at 7:45 pm.
I think it's about time we voted for senators with breasts. After all, we've been voting for boobs long enough. ~Clarie Sargent, Arizona senatorial candidate
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
Reply With Quote  
Join Date: May 2008
Posts: 6
Reputation: InfernalDrake is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
InfernalDrake InfernalDrake is offline Offline
Newbie Poster

Re: Reading a string buffer at the same "output line" as a previous text label

  #3  
May 14th, 2008
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
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb C Marketplace
Thread Tools Display Modes

Other Threads in the C Forum

All times are GMT -4. The time now is 11:01 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC