delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/27/22:05:25

From: "Carlos Matos" <cmatos AT sprintmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Having problems with a simple C program on the djgpp platform in windos 95 using RHIDE
Date: 28 Oct 1997 01:11:13 GMT
Lines: 36
Message-ID: <01bce33e$264a1cc0$a32285ce@default>
NNTP-Posting-Host: 206.133.34.163
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi there guys and girls:


I am a new user of djgpp and RHIDE.  I read that because the new editor of
RHIDE uses a new keyboard handling, it is sometimes neccessary to change
the default about the keyboard.  It says to read the file readme.key but I
cannot get into the site where I got RHIDE anymore so I do not have access
to this file.

I am having problems with the following simple C program.

#include <stdio.h>
#include <string.h>

void main()
{
	char s[1000];
	int count;
	while (gets(s))
		count += strlen(s);
	printf("%d\n",count);
}

The problem is that this program goes into and infinite loop because when I
pressed
CTRL-D, s gets the value of \004 instead of the end-of-file (eof).  Since
gets(s) returns 0 only when s is equal to eof the while loop goes into an
infinite loop.  I do not know how to change the default about my keyboard. 
If this is the problem or if the problem is something else.  Can somebody
help me?  

Thank you.

Carlos Matos
cmatos AT sprintmail DOT com 

- Raw text -


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