LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-09-2009, 06:45 PM   #1
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Rep: Reputation: 164Reputation: 164
C version of the old BASIC 'locate' command


Ok, I'm remembering back to the days of BASIC, when it was simple to set the text cursor location using the LOCATE <x>,<y> command.

I'm for the 20th time, trying to learn C, and maybe this time I'll get past "Hello World". There's so much to learn, and I guess I'll just have to bombard you with questions as they come to me.

I'd like to be able to do the same thing as LOCATE in C, but I can't find any specific references. What is the best way to do this?

P.S. These days, when text consoles can actually be different dimensions (virtual consoles can be resized), this seems like it could be problematic, or at least an interesting feat.
 
Old 12-09-2009, 06:52 PM   #2
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,012

Rep: Reputation: 115Reputation: 115
This sort of interactive control is generally done using ncurses.
 
Old 12-09-2009, 07:03 PM   #3
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
gotoxy in MS-DOS and in curses you use move
 
Old 12-10-2009, 04:10 PM   #4
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
ncurses

But as you trying to learn C and you are at the "Hello World" level, ncurses might be a bit overwhelming. I understand, you need a user interface for your programs. It might be better to create selection lists at first: (1) do this, (2) do that, (3) exit.... and read the integer.

In DOS locate was easy to use because there was just one program running, you had access to the screen buffer, and the screen was always 80x25. Look at the nasty results of this oversimplified approach when EGA cards were introduced and did 80x43.

Ncurses is indeed the solution for windows, text input, selection bar and resized windows and everything you dream of in text mode, but it has a somewhat steep learning curve.

jlinkels
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I locate my fedora version currently running rrocheleau Linux - Newbie 3 04-08-2009 11:40 AM
cpan> locate -u Unknown shell command 'locate -u'. Type ? for help. sharad2005 Linux From Scratch 1 08-04-2006 12:40 AM
whereis / locate and version Kumado SUSE / openSUSE 1 06-21-2005 03:40 PM
version #10.1 CE - how to locate a device ?? bigjohn Mandriva 2 10-23-2004 09:16 PM
What command will locate a particular.. cbjhawks Linux - General 1 03-21-2004 08:07 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration