delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/27/18:47:56

Message-Id: <199710272346.PAA08882@mailgate32>
Reply-To: <cmatos AT sprintmail DOT com>
From: "Carlos Matos" <cmatos AT sprintmail DOT com>
To: <djgpp AT delorie DOT com>
Subject: Problems running a simple C program using RHIDE
Date: Mon, 27 Oct 1997 18:45:44 -0500
MIME-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019