home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!noc.near.net!bigboote.WPI.EDU!nntp!tomster
- From: tomster@bigwpi.WPI.EDU (Thomas Richard Dibble)
- Newsgroups: comp.lang.c
- Subject: Re: Few simple questions
- Date: 21 Jan 93 22:07:33
- Organization: ZikZak Corporation
- Lines: 67
- Message-ID: <TOMSTER.93Jan21220733@bigwpi.WPI.EDU>
- References: <1993Jan21.001022.46578@kuhub.cc.ukans.edu>
- NNTP-Posting-Host: bigwpi.wpi.edu
- In-reply-to: kugold@kuhub.cc.ukans.edu's message of 21 Jan 93 00:10:21 CST
-
- >>>>> On 21 Jan 93 00:10:21 CST, kugold@kuhub.cc.ukans.edu said:
-
- k> L.S.
-
- k> I have a few questions (I am programming in ANSI-C on a UNIX machine) :
-
- k> 1. In unix, the backspace key does not work properly. I already
- k> found out that this can be changed by typing stty erase ^?, where '^?'
- k> means ctrl-?. I tried to include this in my .login file, but emacs does
- k> not accept ^?. How do I put this line in my .login file?
-
- Yeah, this doesn't really fit in this newsgroup, but oh well. Try
- pressing the "`" (backwards single quote --top, left key on keyboard)
- before hitting Ctrl-?. The input buffer of Emacs (the bottom line,
- below the reverse-text or whatever bar) will say "Quote:". The only
- problem with this is that some comm programs reserve use of the "`"
- key for internal use (like activating a menu or somesuch). Then what
- you need to do depends on the program you are using.
-
- k> 2. In C I need an input function like INKEY$ in BASIC, that is a function that
- k> does _not_ wait for input, but just an empty string or so returns if no
- k> character is entered. (I am trying to measure the time between two key-
- k> presses). Does this function exist, and if not, is there any way to do
- k> what I want?
-
- I know of no such beast on UNIX machines. In DOS under TC 2.0 there
- is kbhit(), but I have found no equivalent for UNIX.
-
- k> 3. In C again, I want to initialize and array of integers, like
- k>
- k> main()
- k> {
- k> int ttime[6]={0,0,0,0,0,0}
- k> /* rest of program */
- k> }
-
- k> but the compiler keeps saying:
- k>
- k> "
- k> ccom: Error: tr.c, line 12: no automatic aggregate initialization
- k> int ttime[6]={0,0,0,0,0,0};
- k> ------------------^
- k> ccom: Error: tr.c, line 12: illegal lhs of assignment operator
- k> int ttime[6]={0,0,0,0,0,0};
- k> ---------------------^
- [ deletia ]
- k> "
-
- k> I really don't see what is wrong, the more because in my c-book,
- k> "C by discovery" by L.S. Foster on page 213, almost exactly the
- k> same thing is done.
-
- Well, the problem (I am somewhat sure) is your compiler. If I have
- the story right, this is not in the ANSII standard, and so
- "ANSII-compatible" compilers need not implement it. The only solution
- I know of is to put it into a function called right off the bat or
- switch compilers.
-
-
- ---- tomster@wpi.wpi.edu
-
- --
- /****************************************************************************\
- | "I sometimes used to try to catch her, : FROM: tomster@wpi.wpi.edu |
- | but never even caught her name." : TO: who(m)ever reads it |
- | ---- the cure : CC: programming language |
- \vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv/
-