home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / linux / 20212 < prev    next >
Encoding:
Internet Message Format  |  1992-12-13  |  1.2 KB

  1. Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!cleveland.Freenet.Edu!cc935
  2. From: cc935@cleveland.Freenet.Edu (Gerrold T. Sithe)
  3. Newsgroups: comp.os.linux
  4. Subject: How read characters from /dev/modem/ using C?
  5. Date: 13 Dec 1992 22:07:02 GMT
  6. Organization: Case Western Reserve University, Cleveland, Ohio (USA)
  7. Lines: 18
  8. Message-ID: <1ggc66INNafl@usenet.INS.CWRU.Edu>
  9. NNTP-Posting-Host: hela.ins.cwru.edu
  10.  
  11.  
  12.  
  13.         I'm trying to write a C program that executes a chat script with a
  14. dialup system.  I run my program with input and output redirected to the modem:
  15.  
  16. a.out </dev/modem >/dev/modem
  17.  
  18.         Using scanf to read from the modem doesn't work well because the remote
  19. system doesn't end it's query lines with a newline.  So the prompt, "Enter
  20. Command?" doesn't get received until later.  No good for a chat script.
  21.  
  22.         So I went to a character based input using getchar.  Still the modem
  23. driver won't return a line of data until it receives a newline from the remote
  24. system.  I then tried using the system IO calls open and read with no success.
  25.  
  26.         How can I access the modem on a character-by-character basis or have it
  27. return lines without receiving a newline?
  28.  
  29.