🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.comp.lang.learn.c-c++
Article #840

Re: Help getFileHandle()

#840
From: André Pönitz
Date: Wed, 27 Nov 2002 07:08
20 lines
1902 bytes
In gnu.g++.help Maya <escalante@canada.com> wrote:
> Opening and closing files is such a routine that I want to write a class
> that will handle the opening and closing of files, and I have already done
> most of the work. My problems is when I want to get the file handle, I
> don't know how to do this, exactly. Below is the part of the class that is
> causing the problem

If you want to use that "handle" reference for writing, it can't be const.

>          const std::fstream&  getFileHandle() { return f;               }

  std::fstream&  getFileHandle() { return f; }

But what's the benefit of your class over "plain" fstream?

Andre'

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)
Technical Details
Message-ID: <as1r26$k2s$5@narses.hrz.tu-chemnitz.de>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news-fra1.dfn.de!news-nue1.dfn.de!uni-erlangen.de!news.tu-chemnitz.de!not-for-mail
References: <pan.2002.11.26.22.48.05.391738@canada.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10ba33,cc989fe1e1d8a53f
X-Google-Attributes: gid10ba33,public
X-Google-Thread: 109fba,cc989fe1e1d8a53f
X-Google-Attributes: gid109fba,public
X-Google-Thread: 114592,cc989fe1e1d8a53f
X-Google-Attributes: gid114592,public
X-Google-ArrivalTime: 2002-11-26 23:08:57 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news-fra1.dfn.de!news-nue1.dfn.de!uni-erlangen.de!news.tu-chemnitz.de!not-for-mail
From: André Pönitz <poenitz@gmx.net>
Newsgroups: alt.comp.lang.learn.c-c++,comp.lang.c++,gnu.g++.help
Subject: Re: Help getFileHandle()
Date: 27 Nov 2002 07:08:54 GMT
Organization: Chemnitz University of Technology
Lines: 20
Message-ID: <as1r26$k2s$5@narses.hrz.tu-chemnitz.de>
References: <pan.2002.11.26.22.48.05.391738@canada.com>
NNTP-Posting-Host: millo.mpi.htwm.de
X-Trace: narses.hrz.tu-chemnitz.de 1038380934 20572 141.55.225.177 (27 Nov 2002 07:08:54 GMT)
X-Complaints-To: abuse@tu-chemnitz.de
NNTP-Posting-Date: 27 Nov 2002 07:08:54 GMT