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 423,948 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 4,184 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: Programming Forums
Views: 1088 | Replies: 6
Reply
Join Date: Oct 2006
Posts: 58
Reputation: amishosh is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
amishosh amishosh is offline Offline
Junior Poster in Training

a function keeping the cursor at the end

  #1  
Jan 21st, 2007
Is there an output function in C that keeps the cursor ON the last char printed and NOT after it? (Aside from using gotoxy(wherex()-1,y))

Thanks
Ami
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,126
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: 38
Solved Threads: 929
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: a function keeping the cursor at the end

  #2  
Jan 21st, 2007
No, there is no such function. If you want the cursor at the end, use an operating system specific function to move it there after the text is printed.
Last edited by Ancient Dragon : Jan 21st, 2007 at 1:56 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: Dec 2006
Posts: 232
Reputation: ssharish2005 is on a distinguished road 
Rep Power: 2
Solved Threads: 18
ssharish2005's Avatar
ssharish2005 ssharish2005 is offline Offline
Posting Whiz in Training

Re: a function keeping the cursor at the end

  #3  
Jan 21st, 2007
#include <stdio.h>
int main()
{
    printf("Cursor one space back!!!\b");
    
    getchar();
    return 0;
}

ssharish2005
Reply With Quote  
Join Date: Oct 2006
Posts: 58
Reputation: amishosh is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
amishosh amishosh is offline Offline
Junior Poster in Training

Re: a function keeping the cursor at the end

  #4  
Jan 21st, 2007
Originally Posted by ssharish2005 View Post
#include <stdio.h>
int main()
{
    printf("Cursor one space back!!!\b");
 
    getchar();
    return 0;
}

ssharish2005


EXACTLY what I was looking for.

Thanks!
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,126
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: 38
Solved Threads: 929
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: a function keeping the cursor at the end

  #5  
Jan 21st, 2007
The backspace erases the character underneath the cursor just like it does when you type it on your keyboard. Is that what you want?
Last edited by Ancient Dragon : Jan 21st, 2007 at 4:07 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: Dec 2006
Posts: 232
Reputation: ssharish2005 is on a distinguished road 
Rep Power: 2
Solved Threads: 18
ssharish2005's Avatar
ssharish2005 ssharish2005 is offline Offline
Posting Whiz in Training

Re: a function keeping the cursor at the end

  #6  
Jan 21st, 2007
Well, sorry forgot to mention that. It does display the cursor one position back. But the actual internal char is erased. But the char would be displayed. As Ancient Dragon said.

It would be useful if you just wanted to display the out put message but not use that same out message for further manipulation because the string is altered.

ssharish2005
Reply With Quote  
Join Date: Oct 2006
Posts: 58
Reputation: amishosh is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
amishosh amishosh is offline Offline
Junior Poster in Training

Re: a function keeping the cursor at the end

  #7  
Jan 22nd, 2007
I always want to overwrite the last char so I think it's ok. It's been working fine on my little testing I'm doing
Reply With Quote  
Reply

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

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

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C Forum

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