> Hi,
> 
> My problem is ctrl-d or ctrl-z das not send the EOF(end of file signal) to
> the program running (I get ^z or ^d on the screen).
> The sys. is slackware8.0 KDE emacs g++.
> As I'm desperate ;>)
> On a win2000 with MS. visual 6.0 & dev-c++ not working too.
> 
> Any help is appreciated.
> 
> Thank,
> Jeff
> #include <iostream.h>
> 
> void main()
> {
> 
>  int sum = 0, num;
>  cout << " enter a #";
>  cin >> num;
>  while (!cin.eof())
>  {
>        sum = sum + num;
>        cout << " enter a #";
>        cin >> num;
>   }
>   cout << "sum:" << sum <<endl;
> }
> 


  (1)
It is working here:

$ ./main 
 enter a #1
 enter a #2
 enter a #sum:3
$

(Contrary to what your program says if I enter a `#' character at the 
prompt I get an infinite loop. It only work with an input of integers.)


  (2)
$ g++ -Wall -o main main.cc
main.cc:4: return type for `main' changed to `int'
$

Does not main expected to return int, not void?

  
   (3)
As far as I know ^D is not a signal in the UNIX sense of the term. And 
usually ^Z is the EOF sign in DOS environment. With UNIX the usual 
meaning is suspend.


   (4)
If ^D is not working you might have a problem with the keyboard 
settings or that you assign the EOF for another keyboard combination. 
What does stty -a says? For my machine,

$ stty -a | grep eof
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
$

(And for ^Z:

$ stty -a | grep susp
eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = 
^W;
$
)
-- 

    Shaul Karl
    email: shaulka(at-no-spam)bezeqint.net 
           Please substitute (at-no-spam) with an at - @ - character.
           (at-no-spam) is meant for unsolicitate mail senders only.



--------------------------------------------------------------------------
Haifa Linux Club Mailing List (http://linuxclub.il.eu.org)
To unsub send an empty message to [EMAIL PROTECTED]


Reply via email to