ios::seek_dir

I

Irina Voiculescu

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 help greatly appreciated...
 
V

Victor Bazarov

Irina said:
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 help 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
 
J

James Kanze

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:

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,178
Messages
2,570,955
Members
47,509
Latest member
Jack116

Latest Threads

Top