delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/11/13:24:14

Date: Thu, 11 Jun 1998 20:23:28 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Kbwms AT aol DOT com
cc: djgpp AT delorie DOT com
Subject: Re: Trouble in Function setvbuf()
In-Reply-To: <474d9515.357859d7@aol.com>
Message-ID: <Pine.SUN.3.91.980611202254.26077C-100000@is>
MIME-Version: 1.0

On Fri, 5 Jun 1998 Kbwms AT aol DOT com wrote:

> The purpose of producing these tests is to demonstrate that the
> I/O system is failing somewhere.  In the first test, a file is
> opened, closed, and then reopened.  Then, setvbuf() is applied
> to the file pointer and the first character is read.  It is EOF.
> This is a failure because the first line of code begins with '#'.

I cannot reproduce this problem on any of the machines I have access
to.  I also cannot see anything in the library sources to explain the
behavior you reported.

I attach the output of my testing.  As you see, the test program
reports `#' as the first characters both times.

If you are using some version of the library other than v2.01, please
revert to the original one and try again.  Also, please tell which
command line did you use to compile/link the test program, and what
version of which operating system did you run it on.

Here's the command line I used to compile your test program:

   gcc -Wall -O -g -o tststvbf tststvbf.c

This was done with GCC 2.7.2.1 and Binutils 2.7.  (I also tried
without the -O switch, with identical results.)

And here's the output I get on my system (this is from plain DOS 5.0,
but I got the same on Windows 95):

= = = = = = = = = = TEST # 1 = = = = = = = = = =

Immediately After Opening File tststvbf.c:
Structure for FILE stream associated with file handler 5:
	_cnt            = 0
	_ptr            = 0
	_base           = 0
	_bufsiz         = 0
	_flag           = 8
	_file           = 5
	_name_to_remove = (null)

TESTING SETVBUF

Immediately After Re-Opening File tststvbf.c:
Structure for FILE stream associated with file handler 5:
	_cnt            = 0
	_ptr            = 0
	_base           = 0
	_bufsiz         = 0
	_flag           = 8
	_file           = 5
	_name_to_remove = (null)

Immediately After executing setvbuf():
Structure for FILE stream associated with file handler 5:
	_cnt            = 0
	_ptr            = b210
	_base           = b210
	_bufsiz         = 1024
	_flag           = 9
	_file           = 5
	_name_to_remove = (null)
First Character Read from File:   23 = #

Immediately After Reading Character:
Structure for FILE stream associated with file handler 5:
	_cnt            = 1023
	_ptr            = b211
	_base           = b210
	_bufsiz         = 1024
	_flag           = 9
	_file           = 5
	_name_to_remove = (null)

= = = = = = = = = = TEST # 2 = = = = = = = = = =

Immediately After Opening File tststvbf.c:
Structure for FILE stream associated with file handler 6:
	_cnt            = 0
	_ptr            = 0
	_base           = 0
	_bufsiz         = 0
	_flag           = 8
	_file           = 6
	_name_to_remove = (null)

First Character Read from File: #

Immediately After Reading Character:
Structure for FILE stream associated with file handler 6:
	_cnt            = 4122
	_ptr            = 57001
	_base           = 57000
	_bufsiz         = 16384
	_flag           = 40
	_file           = 6
	_name_to_remove = (null)

TESTING SETVBUF

Immediately After Re-Opening File tststvbf.c:
Structure for FILE stream associated with file handler 6:
	_cnt            = 0
	_ptr            = 0
	_base           = 0
	_bufsiz         = 0
	_flag           = 8
	_file           = 6
	_name_to_remove = (null)

Immediately After executing setvbuf():
Structure for FILE stream associated with file handler 6:
	_cnt            = 0
	_ptr            = b610
	_base           = b610
	_bufsiz         = 1024
	_flag           = 9
	_file           = 6
	_name_to_remove = (null)
First Character Read from File:   23 = #

Immediately After Reading Character:
Structure for FILE stream associated with file handler 6:
	_cnt            = 1023
	_ptr            = b611
	_base           = b610
	_bufsiz         = 1024
	_flag           = 9
	_file           = 6
	_name_to_remove = (null)

- Raw text -


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