PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.cplus > ios::seek_dir
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
ios::seek_dir

Réponse
 
LinkBack Outils de la discussion
Vieux 22/02/2008, 18h23   #1
Irina Voiculescu
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut ios::seek_dir


I'm trying to compile some ten-year-old code. It used
to work fine on my Solaris machine, but I've recently
switched to Fedora 7 and am having to re-install the
lot.

This line doesn't pass compilation:

logfile->seekp(-4,(ios::seek_dir)1);

on the grounds that `seek_dir' is not a member of
`std::ios'. If it's relevant, I'm trying to compile it
with

g++34 -Wno-deprecated

I tried various things, like not qualifying seek_dir at
all, or qualifying with std::ios, both combined with
putting (exactly) one of these lines at the top:

using ios::seek_dir;
using std::ios::seek_dir;
using std::ios;
#include <ios>

but to no avail.

The advice I can get from random places on the web says
that seek_dir should be qualified with ios:: but the
question is, then, how to I tell the compiler to bring
ios into scope?


Any greatly appreciated...

  Réponse avec citation
Vieux 22/02/2008, 18h37   #2
Victor Bazarov
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ios::seek_dir

Irina Voiculescu wrote:
> I'm trying to compile some ten-year-old code. It used
> to work fine on my Solaris machine, but I've recently
> switched to Fedora 7 and am having to re-install the
> lot.
>
> This line doesn't pass compilation:
>
> logfile->seekp(-4,(ios::seek_dir)1);
>
> on the grounds that `seek_dir' is not a member of
> `std::ios'. If it's relevant, I'm trying to compile it
> with
>
> g++34 -Wno-deprecated
>
> I tried various things, like not qualifying seek_dir at
> all, or qualifying with std::ios, both combined with
> putting (exactly) one of these lines at the top:
>
> using ios::seek_dir;
> using std::ios::seek_dir;
> using std::ios;
> #include <ios>
>
> but to no avail.
>
> The advice I can get from random places on the web says
> that seek_dir should be qualified with ios:: but the
> question is, then, how to I tell the compiler to bring
> ios into scope?
>
>
> Any greatly appreciated...


Whip up a small example that has 'ios::seek_dir' (or better
'std::ios_base::seek_dir') and try it on the online Comeau
trial. Get it to compile there, then copy to your machine
and see if it compiles. If it doesn't, you've simply got
a non-compliant compiler, or a buggy one (is there any
difference?)

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


  Réponse avec citation
Vieux 22/02/2008, 19h46   #3
Irina Voiculescu
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ios::seek_dir


It turns out ios::seek_dir has now become ios::seekdir


On Fri, 22 Feb 2008, Irina Voiculescu wrote:

> I'm trying to compile some ten-year-old code. It used to work fine on my
> Solaris machine, but I've recently switched to Fedora 7 and am having to
> re-install the lot.
>
> This line doesn't pass compilation:
>
> logfile->seekp(-4,(ios::seek_dir)1);
>
> on the grounds that `seek_dir' is not a member of `std::ios'. If it's
> relevant, I'm trying to compile it with
>
> g++34 -Wno-deprecated
>
> I tried various things, like not qualifying seek_dir at all, or qualifying
> with std::ios, both combined with putting (exactly) one of these lines at the
> top:
>
> using ios::seek_dir;
> using std::ios::seek_dir;
> using std::ios;
> #include <ios>
>
> but to no avail.
>
> The advice I can get from random places on the web says that seek_dir should
> be qualified with ios:: but the question is, then, how to I tell the compiler
> to bring ios into scope?
>
>
> Any greatly appreciated...

  Réponse avec citation
Vieux 22/02/2008, 20h43   #4
James Kanze
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ios::seek_dir

On Feb 22, 7:23 pm, Irina Voiculescu <ir...@comlab.ox.ac.uk> wrote:
> I'm trying to compile some ten-year-old code. It used
> to work fine on my Solaris machine, but I've recently
> switched to Fedora 7 and am having to re-install the
> lot.


> This line doesn't pass compilation:


> logfile->seekp(-4,(ios::seek_dir)1);


> on the grounds that `seek_dir' is not a member of
> `std::ios'.


I'd start by asking what this code is supposed to do. It has no
defined meaning according to the standard, and didn't have any
in any of the pre-standard implementations I used. (According
to the standard, the type's name is std::ios::seekdir, but
casting an arbitrary numerical value to that type has no defined
meaning.)

> The advice I can get from random places on the web says
> that seek_dir should be qualified with ios:: but the
> question is, then, how to I tell the compiler to bring
> ios into scope?


ios is in scope std. But the problem here is much deeper. The
only legal values for the second argument of ostream::seekp are
std::ios::beg, std::ios::cur or std::ios::end. Anything else is
simply undefined behavior.

--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 11h57.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11570 seconds with 12 queries