A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/1999-July/000547.html below:

[Python-Dev] End of the line

[Python-Dev] End of the line [Python-Dev] End of the lineM.-A. Lemburg mal@lemburg.com
Sun, 18 Jul 1999 22:29:43 +0200
Tim Peters wrote:
> 
> Anyone know offhand if there's a reliable way to determine whether an open
> file descriptor (a C FILE*) is seekable?

I'd simply use trial&error:

if (fseek(stream,0,SEEK_CUR) < 0) {
	if (errno != EBADF)) {
		/* Not seekable */
		errno = 0;
	}
	else
		/* Error */
		;
}
else
	/* Seekable */
	;

How to get this thread safe is left as exercise to the interested
reader ;)

Cheers,
-- 
Marc-Andre Lemburg
______________________________________________________________________
Y2000:                                                   166 days left
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4