469,648 Members | 1,137 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,648 developers. It's quick & easy.

How to support Large file size with ofstream ?

Hi All

I have a application which is basically a log manager and accepts log
messages from other processes and logs them in files ( one file per
process per day ). The application manages the creating of log files,
formatting the incoming log messages with proper time stamp and writing
the logs in the respective log files.

I am using C++ ofstream for doing the file operations in Linux 2.4 .

I want to implement large file support so that when the logfile size
reaches 2GB limit the system doesnt exit with signal SIGXFSZ.

I know that this works in C using -D_LARGEFILE_SOURCE flag.
But I want to know how to implement this in C++ , and using only
ofstream ?

I am not sure it it is possible that way without using mix of FILE and
ofstream

Any suggestions?

thanks in advance
Shyam

Oct 9 '06 #1
1 2601
On 9 Oct 2006 05:34:23 -0700, "shyam" <sh********@gmail.comwrote in
comp.lang.c++:
Hi All

I have a application which is basically a log manager and accepts log
messages from other processes and logs them in files ( one file per
process per day ). The application manages the creating of log files,
formatting the incoming log messages with proper time stamp and writing
the logs in the respective log files.

I am using C++ ofstream for doing the file operations in Linux 2.4 .

I want to implement large file support so that when the logfile size
reaches 2GB limit the system doesnt exit with signal SIGXFSZ.

I know that this works in C using -D_LARGEFILE_SOURCE flag.
But I want to know how to implement this in C++ , and using only
ofstream ?

I am not sure it it is possible that way without using mix of FILE and
ofstream

Any suggestions?

thanks in advance
Shyam
The C++ language does not set any limits on the size of a file. Any
limits that are set are by your particular compiler, its library, and
your operating system, not the language.

"-D_LARGEFILE_SOURCE" is not something defined by C or C++, but
something provided by your compiler, its library, and your operating
system.

The place to ask about overcoming such limitations is a group that
supports, surprise, surprise!, your compiler and operating system
combination.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Oct 10 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Joseph | last post: by
3 posts views Thread by Romain | last post: by
5 posts views Thread by alex | last post: by
3 posts views Thread by Kat | last post: by
5 posts views Thread by B. Williams | last post: by
14 posts views Thread by JoeC | last post: by
13 posts views Thread by liujiaping | last post: by
21 posts views Thread by pilafi | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.