www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/05/30/06:57:51

From: Russell Day <russ AT pta DOT pyramid DOT com DOT au>
Subject: cin problem.
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Date: Sun, 30 May 1993 20:00:16 +1000

I have a teeny problem with cin: The example program below runs away
after about 34 lines. cout.flush() doesnt help.  If the prompt is
terminated with a "\n" then the program will run successfully into the
hundreds of prompts.

This may be a djgpp bug (in which case, it has probably already been
reported, so where can I get the fix - I am running 222, I think.)  Or
it might be a problem with my setup (like DOS 6, for example.)

By runs away, I mean that the prompts come immediately after data
entry until the 34th prompt then it stalls.  After about 20 seconds
the disk goes feral (presumably paging) for 5 sec and then the
following is printed:
	Segmentation violation in pointer 0x00000027 at 40:3568
	Exception 14 at eip=3568
(Is there a source code debugger for use with djgpp?)
The apparatus which runs this is a 486SX with 12 MB and DOS 6 (~~shudder~~)

Ah, and another question - does anyone have any measurements to help
me decide whether I should by this box a cpu cache?  It has none, and
compiling the program below takes about 20 sec.  The assignment (due
tomorrow, and now probably shot after the cin debacle) is about 400
lines and takes about a minute.  20 sec is too long, but for $200 for
256k, I want to know what sort of difference it makes in real terms.

Thanks for the help.
Russ.

-----------------------------------8<-----------------------------------------
#include <stream.h>
main()
{
	int num = 1 ;	
	int count = 0; 

	// Count can be removed without affecting the problem... it is
	// just there to count the number of lines before runaway.
	// Adding a '\n' after the word 'number' causes the problem to
	// go away.

	while (num)
	{
		cout << count++ << " Enter a number";
		cin >> num;
	}
}


- Raw text -


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