delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/12/22:15:46

From: PeeTee <peter95 AT hem DOT passagen DOT se>
Newsgroups: comp.os.msdos.djgpp
Subject: I want a search string...
Date: Thu, 12 Mar 1998 18:40:35 +0100
Organization: Telia Internet Services
Lines: 66
Message-ID: <35081E12.FAE8A9B6@hem.passagen.se>
NNTP-Posting-Host: d2o44.telia.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi out there!
I have a problem and i think somebody can solve it easy...

In a program i want the user to enter a search sting...
But the problem is that while he do this, the program must do other
things at the same time (almost...)

The code looks like this:



char search_for[256];
int ok;


enter_string()
{


if(key[KEY_ENTER])
    ok = TRUE;


// Code that adds the pressed key to search_for
// if enter isn't pressed...

}//end of enter_String()


main()
{

//lots of code...

ok = FALSE;
do
{

redraw_graphics();

enter_string();

}until(ok);

// more code...

}//end of main()

The point is that enter_string don't wait for a ENTER... The program
loops and add entered keys to search_for.
The loop ends when the user press ENTER.

I tried to use


if(keypressed())
     search_for = search_for + readkey();

but search_for looks funny when i use textout...

I hope you understand my little problem and help me asap.
Sorry for any misspelling or use of bad gramatics... (Hey, i'm from
sweden... ;)

/Pete

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019