delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/05/07:33:09

From: mjara AT cadesm55 DOT eng DOT utah DOT edu (Michael Jara)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: seekg/fstream problem
Date: 5 Sep 1997 08:03:31 GMT
Organization: University of Utah Computer Science Department
Lines: 17
Message-ID: <5uoecj$j27@magus.cs.utah.edu>
References: <5udrk8$c1d AT magus DOT cs DOT utah DOT edu> <340E3582 DOT 75BC8AF7 AT alcyone DOT com> <5unisg$dtc AT magus DOT cs DOT utah DOT edu> <5uo6ej$hf9 AT magus DOT cs DOT utah DOT edu>
NNTP-Posting-Host: cadesm55.eng.utah.edu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Okay, in case anyone is interested, I think I found a solution.  What
I was doing with a database object's load function was passing in a
streampos (initially zero) and as data was read in I used gcount() to
count the bytes.  I then totalled these bytes and returned them.  This
number was passed into the function for the next seekg().  Everything
seemed to work fine with this except that seekg simply didn't like it!

It seems to work if instead of counting up the bytes with gcount you
simply tellg() at the end and return that value (for the next seekg).
I don't know why I didn't do this in the first place!

--
    _____   ___  ___  ___  ___  ______                                __
   /     | /   ||   ||   |/  / |    __|      mjara AT eng DOT utah DOT edu       \ \
  /      |/    ||   ||      /  |    _]  http://www.cs.utah.edu/~mjara  \ \
 /   /|        ||   ||       \ |   |____________________________________\ \
/___/ |____/ __||___||___|\___\|___________________________________________\ 

- Raw text -


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