Mail Archives: djgpp/1997/10/27/18:47:56
Hi there fellow programmers.
I recently install RHIDE and I am just getting myself use to it. I read
something in the README.IDE file that told me that because the new editor
of RHIDE uses a new keyboard handling, it is sometimes neccessary to change
the defaults about the keyboard. I try to find a file name readme.key but
I can no longer access the site where I got RHIDE from. It keep saying
that there is no such a site name ~rho.
Maybe this is the reason why I am having problems running the following
program.
#include <stdio.h>
#include <string.h>
void main()
{
ch s[1000];
int count;
while (gets(s))
count += strlen(s);
printf("%d\n", count);
}
This simple program is supposed to keep on reading from the standard input
file until
you press CTRL-D to signal and end-of-file (eof). gets reads a line until
it detects eof, then returns a 0 so the while loop ends and when you press
CTRL-D, you see a count of the number of character in the stdout (the
screen).
I traced the program in with RHIDE and everything works great until I press
CTRL-D. At this point and time the value of s is \004. This is not equal
to the end-of-file. Therefore it does not exit the while loop and it
continues reading whithout end. I believe that my problem is that I have
to change the defaults about the keyboard. I do not know how to do this.
Can somebody help me, please?
Carlos M. Matos
- Raw text -