home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / c / 20008 < prev    next >
Encoding:
Text File  |  1993-01-21  |  2.4 KB  |  71 lines

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!kuhub.cc.ukans.edu!kugold
  2. From: kugold@kuhub.cc.ukans.edu
  3. Newsgroups: comp.lang.c
  4. Subject: Few simple questions
  5. Message-ID: <1993Jan21.001022.46578@kuhub.cc.ukans.edu>
  6. Date: 21 Jan 93 00:10:21 CST
  7. Organization: University of Kansas Academic Computing Services
  8. Lines: 61
  9.  
  10. L.S.
  11.  
  12. I have a few questions (I am programming in ANSI-C on a UNIX machine) :
  13.  
  14. 1. In unix, the backspace key does not work properly. I already 
  15.    found out that this can be changed by typing stty erase ^?, where '^?' 
  16.    means ctrl-?. I tried to include this in my .login file, but emacs does 
  17.    not accept ^?. How do I put this line in my .login file?
  18.  
  19. 2. In C I need an input function like INKEY$ in BASIC, that is a function that
  20.    does _not_ wait for input, but just an empty string or so returns if no 
  21.    character is entered. (I am trying to measure the time between two key-
  22.    presses). Does this function exist, and if not, is there any way to do
  23.    what I want?
  24.  
  25. 3. In C again, I want to initialize and array of integers, like
  26.    
  27.    main()
  28.    {
  29.      int ttime[6]={0,0,0,0,0,0}
  30.      /* rest of program */
  31.    }
  32.  
  33.    but the compiler keeps saying:
  34.     
  35. ccom: Error: tr.c, line 12: no automatic aggregate initialization
  36.         int     ttime[6]={0,0,0,0,0,0};
  37.       ------------------^
  38. ccom: Error: tr.c, line 12: illegal lhs of assignment operator
  39.         int     ttime[6]={0,0,0,0,0,0};
  40.       ---------------------^
  41. ccom: Error: tr.c, line 12: illegal lhs of assignment operator
  42.         int     ttime[6]={0,0,0,0,0,0};
  43.       -----------------------^
  44. ccom: Error: tr.c, line 12: illegal lhs of assignment operator
  45.         int     ttime[6]={0,0,0,0,0,0};
  46.       -------------------------^
  47. ccom: Error: tr.c, line 12: illegal lhs of assignment operator
  48.         int     ttime[6]={0,0,0,0,0,0};
  49.       ---------------------------^
  50. ccom: Error: tr.c, line 12: illegal lhs of assignment operator
  51.         int     ttime[6]={0,0,0,0,0,0};
  52.       -----------------------------^
  53. ccom: Error: tr.c, line 12: illegal lhs of assignment operator
  54.         int     ttime[6]={0,0,0,0,0,0};
  55.       -------------------------------^
  56. "
  57.  
  58.    I really don't see what is wrong, the more because in my c-book,
  59.    "C by discovery" by L.S. Foster on page 213, almost exactly the
  60.    same thing is done.
  61.  
  62. Thanks a lot in advance for any answer and I am sorry if the UNIX question 
  63. doesn't belong in this newsgroup.
  64.  
  65. Regards,
  66.  
  67. Wimjan
  68.  
  69. kugold@kuhub.cc.ukans.edu 
  70.