Problems openning huge files

This is a discussion on Problems openning huge files within the C Programming forums, part of the General Programming Boards category; Dear friends, I have a huge problem. I must open files greater than 2Gb in a C program, but I ...

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    2

    Problems openning huge files

    Dear friends,

    I have a huge problem. I must open files greater than 2Gb in a C program, but I could not do this with the fopen() or ifstream().

    How can I open and read big files like that?

    Please, could someone help me?


    Thanks in advance.


    Regards,

    Antonio.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826

    Re: Problems openning huge files

    Originally posted by acoelho74
    Dear friends,

    I have a huge problem. I must open files greater than 2Gb in a C program, but I could not do this with the fopen() or ifstream().

    How can I open and read big files like that?
    I'll speculate, since you provide no insight as to what you're using. Get a new OS, BIOS, and compiler.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Feb 2003
    Posts
    2
    A little more details...

    I'm developing a system that must open and process text files with more than 2Gb of data.

    I tried to open this files with the fopen() and ifstream() functions, but it didn't work. As it seems, the fopen() function has a limit of 2Gb.

    I' developing this in a HP-UX system, with enoght memory to do that.

    I think that this functions doesn't support this size of files.


    Thanks.

  4. #4
    Registered User Vber's Avatar
    Join Date
    Nov 2002
    Posts
    807
    Hmm, you receive any error message, what errno says?
    with glibc, I think you have to use -D_FILE_OFFSET_BITS=64 or *64.
    Last edited by Vber; 02-11-2003 at 05:15 PM.

  5. #5
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Have you look at open()
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problems using two files
    By dwygal in forum C++ Programming
    Replies: 1
    Last Post: 03-02-2006, 09:15 PM
  2. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 04:30 PM
  3. Using c++ standards
    By subdene in forum C++ Programming
    Replies: 4
    Last Post: 06-06-2002, 10:15 AM
  4. reinserting htm files into chm help files
    By verb in forum Windows Programming
    Replies: 0
    Last Post: 02-15-2002, 09:35 AM
  5. Problems with resource files
    By Unregistered in forum C++ Programming
    Replies: 18
    Last Post: 08-31-2001, 09:45 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21