Problem creating files greater than 2GB


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Problem creating files greater than 2GB
# 1  
Old 01-17-2007
Problem creating files greater than 2GB

With the C code I am able to create files greater than 2GB if I use the 64 bit compile option -D_FILE_OFFSET_BITS=64. There I am using the function fprintf to write into the file. But when I use C++ and ofstream the file is getting truncated when the size grows beyond 2GB. Is there any special compile option needed to overcome this?

My OS is - SunOS 5.8
# 2  
Old 01-17-2007
With the GNU gcc compiler, specifying the "-m64" option generates code for the 64-bit environment which includes 8-bytes for a file offset. I normally use low-level I/O with which you can specify the O_LARGEFILE status flag when working in a 32-bit environment.

In short, try compiling with the -m64 option.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with Greater Than Or Equal To

BASH problem with IS GREATER THAN OR EQUAL TO. I have tried a dozen variations for this IF statement to work with IS GREATER THAN OR EQUAL TO. My code below WORKS. array=( $( /usr/bin/sar -q 1 30 |grep Average |awk '{print $2,$3}' ) ) nthreads="${array}" avproc="${array}" if && ; then ... (6 Replies)
Discussion started by: diex
6 Replies

2. AIX

Tar files larger than 2GB

Hi, Does anyone know if it is possible to tar files larger than 2GB? The reason being is they want me to dump a single file (which is around 20GB) to a tape drive and they will restore it on a Solaris box. I know the tar have a limitation of 2GB so I am thinking of a way how to overcome this.... (11 Replies)
Discussion started by: depam
11 Replies

3. Homework & Coursework Questions

Problem with awk,not able print the file that is greater than 3000 bytes.

My Script: #!/bin/sh date=`date +%y%m%d -d"1 day ago"` in_dir=/vis/logfiles/to_solmis cp `grep -il ST~856~ $inbound_dir/*$date*` /vis/sumit/in_ASN/ for i in /vis/sumit/in_ASN/* do mkdir -p /vis/sumit/inboundasns.$date cp `echo $i`... (1 Reply)
Discussion started by: shrima.pratima
1 Replies

4. Linux

Compress files >2GB

Hi folks, I'm trying to compress a certain number of files from a cifs mount to a xfs mount, but cannot do it when the total size of the files is bigger than 2GB. Is there any limitation for above 2GB? OS is SLES 64bit The files are maximum 1MB, so there are aprox. 2000 files to compress... (2 Replies)
Discussion started by: xavix
2 Replies

5. AIX

Creating > 2GB file

I am trying to execute a database dump to a file, but can't seem to get around the 2GB file size. I have tried setting the user limit to -1, but no luck. (4 Replies)
Discussion started by: markper
4 Replies

6. Linux

Problem with creating big files

Hi... I have a very wired problem with my redhat4 update 4 server... Every time i create a file bigger then my physical memory the server kills the process\session that creates the file, and in the "messages" file i see this error: "Oct 21 15:22:22 optidev kernel: Out of Memory: Killed process... (6 Replies)
Discussion started by: eliraza6
6 Replies

7. Shell Programming and Scripting

cpio - files > 2gb

Hi, Currently a backup script copies compressed files to tape using cpio command (on AIX 5.2). Recently we've had a compressed file which has gone over 2 GB in size resulting in an error while copying this file onto the tape using cpio. Any suggestions on relevant workarounds would be much... (2 Replies)
Discussion started by: dnicky
2 Replies

8. Filesystems, Disks and Memory

Use of unzip with content files > 2Gb

I am zipping and downloading zip files from an AS400 using the unzip utility. The files are being downloaded onto a Solaris box. Some of the content files in the zip are larger than 2GB. When using the unzip utility (version 5.32), it complains of 'disk full'. The disk is not full, I still have... (2 Replies)
Discussion started by: tcarlson
2 Replies

9. Programming

C++ Problem, managing >2Gb file

My C++ program returns 'Disk Full' Message when I tried to manage a file larger than 2Gb. the process is very simple: based on a TXT file, the process combine the information generating another temporary file (generating the error) to fillup a database. My FS, during the process, reaches 40%...... (4 Replies)
Discussion started by: ASOliveira
4 Replies

10. UNIX for Dummies Questions & Answers

largefile (>2gb) problem

i'm working on SCO unix 7 and i'm trying to be able to creat files greater than 2GB. i've done the following and still haven't soved the problem: 1) fsadm -F vxfs -o largefiles 2) ulimit -f, -d, -s, -c unlimited 3) scoadmin > system tuning > Defaults manager > vxfs defaults: stting maxsize... (3 Replies)
Discussion started by: roydv
3 Replies
Login or Register to Ask a Question