G++ 3.3.2 and Files over 2 gb

C

cannyf

Hi,

I have g++ 3.3.2 installed on sun solaris sparc machine and I am trying
to to read files greater than 2gb.

I compile the code as follows:g++ -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE -v -o Test test.cpp

Anyone any ideas why my program will not read over 2 gb.

Regards
Fergal
 
E

Earl Purple

Hi,

I have g++ 3.3.2 installed on sun solaris sparc machine and I am trying
to to read files greater than 2gb.

I compile the code as follows:g++ -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE -v -o Test test.cpp

Anyone any ideas why my program will not read over 2 gb.

Regards
Fergal

This is actually the wrong newsgroup for compiler-specific settings.
(Try a GNU-specific newsgroup).

It may well have something to do with the typedefs in char_traits<char>
so you could write your own traits class that uses 64-bit addresses.

Use these

typedef std::streampos pos_type;
typedef long long off_type;

typedef std::mbstate_t state_type;

if "long long" is 64-bit on your compiler as it is off_type in
char_traits that can cause the problems.
 
V

Victor Bazarov

I have g++ 3.3.2 installed on sun solaris sparc machine and I am
trying to to read files greater than 2gb.

I compile the code as follows:g++ -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE -v -o Test test.cpp

Anyone any ideas why my program will not read over 2 gb.

The library that comes with your implementation is incapable of it,
most likely. If so, it's implementation-specific. You can ask about
it in 'gnu.g++.help' or use their mailing lists. There are also OS-
specific newsgroups. Try them as well.

V
 
V

Victor Bazarov

Earl said:
[...]
Use these

typedef std::streampos pos_type;
typedef long long off_type;

There is no 'long long' type in C++, you know that, right?
typedef std::mbstate_t state_type;

if "long long" is 64-bit on your compiler as it is off_type in
char_traits that can cause the problems.

V
 
E

Earl Purple

Victor said:
Earl said:
[...]
Use these

typedef std::streampos pos_type;
typedef long long off_type;

There is no 'long long' type in C++, you know that, right?
yes I know that which is why I said "whatever the type is on your
machine"or words to that effect. I think GNU does define a long long as
an extension.
 

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

No members online now.

Forum statistics

Threads
474,436
Messages
2,571,696
Members
48,796
Latest member
Greg L.
Top