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

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!usc!sol.ctr.columbia.edu!emory!swrinde!ringer!pnarsipu
  3. From: pnarsipu@ringer.cs.utsa.edu (Praasad Y. Narsipur)
  4. Subject: Re: Few simple questions
  5. Message-ID: <1993Jan22.225219.18959@ringer.cs.utsa.edu>
  6. Organization: University of Texas at San Antonio
  7. References: <1993Jan21.001022.46578@kuhub.cc.ukans.edu>
  8. Date: Fri, 22 Jan 1993 22:52:19 GMT
  9. Lines: 72
  10.  
  11. In article <1993Jan21.001022.46578@kuhub.cc.ukans.edu> kugold@kuhub.cc.ukans.edu writes:
  12. >L.S.
  13. >
  14. >I have a few questions (I am programming in ANSI-C on a UNIX machine) :
  15. >
  16. >1. In unix, the backspace key does not work properly. I already 
  17. >   found out that this can be changed by typing stty erase ^?, where '^?' 
  18. >   means ctrl-?. I tried to include this in my .login file, but emacs does 
  19. >   not accept ^?. How do I put this line in my .login file?
  20. >
  21. >2. In C I need an input function like INKEY$ in BASIC, that is a function that
  22. >   does _not_ wait for input, but just an empty string or so returns if no 
  23. >   character is entered. (I am trying to measure the time between two key-
  24. >   presses). Does this function exist, and if not, is there any way to do
  25. >   what I want?
  26. >
  27. >3. In C again, I want to initialize and array of integers, like
  28. >   
  29. >   main()
  30. >   {
  31. >     int ttime[6]={0,0,0,0,0,0}
  32. >     /* rest of program */
  33. >   }
  34. >
  35. >   but the compiler keeps saying:
  36. >    
  37. >" 
  38. >ccom: Error: tr.c, line 12: no automatic aggregate initialization
  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. >ccom: Error: tr.c, line 12: illegal lhs of assignment operator
  57. >        int     ttime[6]={0,0,0,0,0,0};
  58. >      -------------------------------^
  59. >"
  60. This looks perfect. This should probably u would have left something
  61. in your program. This works for me. 
  62. Try giving blanks between '0' and `,`.
  63.  
  64.  
  65. >   I really don't see what is wrong, the more because in my c-book,
  66. >   "C by discovery" by L.S. Foster on page 213, almost exactly the
  67. >   same thing is done.
  68.  
  69. read K&R c book chapter on Arrays.
  70.  
  71. Prasad V Narsipur.
  72.  
  73. >Thanks a lot in advance for any answer and I am sorry if the UNIX question 
  74. >doesn't belong in this newsgroup.
  75. >
  76. >Regards,
  77. >
  78. >Wimjan
  79. >
  80. >kugold@kuhub.cc.ukans.edu 
  81.  
  82.  
  83.