Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Text location

Reply
Thread Tools

Text location

 
 
Mike
Guest
Posts: n/a
 
      04-07-2004
I am just begninning C and I was wondering this:

Just like in QBASIC yuo can use the LOCATE y, x function. Is there a
way to do this in C?
 
Reply With Quote
 
 
 
 
Joona I Palaste
Guest
Posts: n/a
 
      04-07-2004
Mike <> scribbled the following:
> I am just begninning C and I was wondering this:


> Just like in QBASIC yuo can use the LOCATE y, x function. Is there a
> way to do this in C?


Not portably. Some platforms provide non-standard extensions, for
example "conio" for Microsoft systems.

--
/-- Joona Palaste () ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"How come even in my fantasies everyone is a jerk?"
- Daria Morgendorfer
 
Reply With Quote
 
 
 
 
Ben Pfaff
Guest
Posts: n/a
 
      04-07-2004
(Mike) writes:

> I am just begninning C and I was wondering this:
>
> Just like in QBASIC yuo can use the LOCATE y, x function. Is there a
> way to do this in C?


This is in the FAQ.

19.4: How can I clear the screen?
How can I print text in color?
How can I move the cursor to a specific x, y position?

A: Such things depend on the terminal type (or display) you're
using. You will have to use a library such as termcap,
terminfo, or curses, or some system-specific routines, to
perform these operations. On MS-DOS systems, two functions
to look for are clrscr() and gotoxy().

For clearing the screen, a halfway portable solution is to print
a form-feed character ('\f'), which will cause some displays to
clear. Even more portable (albeit even more gunky) might be to
print enough newlines to scroll everything away. As a last
resort, you could use system() (see question 19.27) to invoke
an operating system clear-screen command.

References: PCS Sec. 5.1.4 pp. 54-60, Sec. 5.1.5 pp. 60-62.

--
int main(void){char p[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv wxyz.\
\n",*q="kl BIcNBFr.NKEzjwCIxNJC";int i=sizeof p/2;char *strchr();int putchar(\
);while(*q){i+=strchr(p,*q++)-p;if(i>=(int)sizeof p)i-=sizeof p-1;putchar(p[i]\
);}return 0;}
 
Reply With Quote
 
Dan Pop
Guest
Posts: n/a
 
      04-07-2004
In < > (Mike) writes:

>I am just begninning C and I was wondering this:
>
>Just like in QBASIC yuo can use the LOCATE y, x function. Is there a
>way to do this in C?


Since some of us haven't yet begun QBASIC, you may want to explain what
the LOCATE y, x QBASIC function is supposed to do. If it's about locating
a substring inside a string, strstr() does the job.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email:
 
Reply With Quote
 
Joona I Palaste
Guest
Posts: n/a
 
      04-07-2004
Dan Pop <> scribbled the following:
> In < > (Mike) writes:
>>I am just begninning C and I was wondering this:
>>
>>Just like in QBASIC yuo can use the LOCATE y, x function. Is there a
>>way to do this in C?


> Since some of us haven't yet begun QBASIC, you may want to explain what
> the LOCATE y, x QBASIC function is supposed to do. If it's about locating
> a substring inside a string, strstr() does the job.


No. It moves the console cursor to row #y, column #x.

--
/-- Joona Palaste () ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"Ice cream sales somehow cause drownings: both happen in summer."
- Antti Voipio & Arto Wikla
 
Reply With Quote
 
Mike
Guest
Posts: n/a
 
      04-08-2004
(Dan Pop) wrote in message news:<c51ec4$e3f$>...
> In < > (Mike) writes:


> Since some of us haven't yet begun QBASIC, you may want to explain what
> the LOCATE y, x QBASIC function is supposed to do. If it's about locating
> a substring inside a string, strstr() does the job.
>

Example

LOCATE2, 5
PRINT "Hello World!"


OBTW thanks guys for the stuff!
 
Reply With Quote
 
Dan Pop
Guest
Posts: n/a
 
      04-08-2004
In <c51f45$neg$> Joona I Palaste <> writes:

>Dan Pop <> scribbled the following:
>> In < > (Mike) writes:
>>>I am just begninning C and I was wondering this:
>>>
>>>Just like in QBASIC yuo can use the LOCATE y, x function. Is there a
>>>way to do this in C?

>
>> Since some of us haven't yet begun QBASIC, you may want to explain what
>> the LOCATE y, x QBASIC function is supposed to do. If it's about locating
>> a substring inside a string, strstr() does the job.

>
>No. It moves the console cursor to row #y, column #x.


I actually knew that, but I wanted to point out the ambiguity of the
question, *especially* considering the subject line.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email:
 
Reply With Quote
 
Joona I Palaste
Guest
Posts: n/a
 
      04-08-2004
Dan Pop <> scribbled the following:
> In <c51f45$neg$> Joona I Palaste <> writes:
>>Dan Pop <> scribbled the following:
>>> In < > (Mike) writes:
>>>>I am just begninning C and I was wondering this:
>>>>
>>>>Just like in QBASIC yuo can use the LOCATE y, x function. Is there a
>>>>way to do this in C?

>>
>>> Since some of us haven't yet begun QBASIC, you may want to explain what
>>> the LOCATE y, x QBASIC function is supposed to do. If it's about locating
>>> a substring inside a string, strstr() does the job.

>>
>>No. It moves the console cursor to row #y, column #x.


> I actually knew that, but I wanted to point out the ambiguity of the
> question, *especially* considering the subject line.


Well you sure were subtle about it. You had me fooled into thinking you
didn't know it.

--
/-- Joona Palaste () ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"Insanity is to be shared."
- Tailgunner
 
Reply With Quote
 
Thomas Stegen
Guest
Posts: n/a
 
      04-08-2004
Joona I Palaste wrote:

>
> Well you sure were subtle about it. You had me fooled into thinking you
> didn't know it.
>


To me his point was clear as crystal. His BASIC skills were clearly
impossible to deduce from what he said, but clearly not the point.

--
Thomas.

 
Reply With Quote
 
Vic Dura
Guest
Posts: n/a
 
      04-08-2004
On 8 Apr 2004 14:22:18 GMT, RE: Re: Text location Joona I Palaste
<> wrote:

>>>> Since some of us haven't yet begun QBASIC, you may want to explain what
>>>> the LOCATE y, x QBASIC function is supposed to do. If it's about locating
>>>> a substring inside a string, strstr() does the job.
>>>
>>>No. It moves the console cursor to row #y, column #x.

>
>> I actually knew that, but I wanted to point out the ambiguity of the
>> question, *especially* considering the subject line.

>
>Well you sure were subtle about it. You had me fooled into thinking you
>didn't know it.


Yes, he had me fooled too.

Now he has me fooled into thinking that he can't admit he was wrong;
possibly because that would be an egregious (but common) character
trait in someone who delights in correcting others.

--
To reply to me directly, remove the XXX characters from my email address.
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to get the text from browser location bar *before*navigation (e.g. not location.href) Alex Bird Javascript 3 05-09-2008 02:15 PM
Mouse Location to Text line or Text line to location kuna.subramaniyam@gmail.com Javascript 2 04-14-2008 01:46 PM
Location, location, location =?Utf-8?B?VHJhY2V5?= Wireless Networking 2 02-17-2007 08:37 PM
How to trick a page into running at a location different from it'sphysical location? Luke Dalessandro ASP .Net 0 01-15-2006 05:59 AM
location of asp text vs html text bbxrider ASP General 2 07-06-2003 08:56 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57