473,790 Members | 3,246 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

maximum file size of FOPEN

I tried to open some large files in my computer. (ram 512MB)

1. is there limitation of file size FOPEN?

2. if I have a file that is larger than the maximum size, how can I
open the file?

Nov 14 '05
15 15502
1. It depends on the system. If the files can exist in your computer,
FOPEN can open it.

For FREAD, FWRITE, etc, the limitaion of file size is size_t, it also
depends on the system. In most of the systems, size_t is a 32-bits
unsigned inteter. In such system, the limitation is 4G - 1.

Nov 14 '05 #11
1. It depends on the system. If the files can exist in your computer,
FOPEN can open it.

For FREAD, FWRITE, etc, the limitaion of file size is size_t, it also
depends on the system. In most of the systems, size_t is a 32-bits
unsigned inteter. In such system, the limitation is 4G - 1.

Nov 14 '05 #12
In article <11************ **********@g14g 2000cwa.googleg roups.com>,
<zh********@163 .com> wrote:
For FREAD, FWRITE, etc, the limitaion of file size is size_t, it also
depends on the system. In most of the systems, size_t is a 32-bits
unsigned inteter. In such system, the limitation is 4G - 1.


According to opengroup.org the limit is off_t which is a type
specifically for file sizes -- and it is a signed type.
fseek can return (off_t)-1 when the seek is not meaningful, so
it cannot be an unsigned type.

opengroup.org classifies off_t as an "extended signed integral type".
An "extended" integral type isn't limited to the usual short/int/long
types, provided that the type has "the same properties".
[For this purpose, it helps to remember that the UNIX98 specification
predates C99's formalization of the existance of 'long long'.]
--
Oh, to be a Blobel!
Nov 14 '05 #13
uremae wrote:
then how can I read the large file that is larger than gigabye with
what system-specific calls in linux or unix.


It's also worth mentioning that if stream processing is all
you're after then you can read a file of any size through a pipe.
For instance:

cat hugefile | processit > outfile

should work no matter how large hugefile is.
Processit just reads from stdin and writes to stdout
using standard C I/O functions. This assumes that
"cat" can read the huge file, but I've not yet
encountered a linux/unix system where cat cannot
do so.

Regards,

David Mathog
ma****@caltech. edu
Nov 14 '05 #14
On 19 May 2005 21:57:05 GMT, ro******@ibd.nr c-cnrc.gc.ca (Walter
Roberson) wrote:
In article <d6**********@n wrdmz02.dmz.ncs .ea.ibs-infra.bt.com>,
Malcolm <re*******@btin ternet.com> wrote:
"uremae" <ur****@gmail.c om> wrote
1. is there limitation of file size FOPEN?

There's ususally some limit, though it might be so large that there is no
chance of exceeding it.


Could you give us an example of a system with such a limit, Malcolm ?

I have certainly run into systems whose filesize was limited
(with different limits for different filesystem types), but I
cannot think of anything in C or POSIX.1 or any implementation
that I have -encountered- that would fopen() for opening a


IAYM would _fail_ or _reject_ or somesuch on the fopen.
[plain] file for read once the file had made it on to the
filesystem.

Not an actual example, but one idea of how someone might conceivably
get into such a fix:

Multics had normal files limited to 256KW = 1MB (of 9 bits) and there
was no easy way to increase this because files were tied to (most)
segments in the virtual memory. For people who needed bigger there
was a feature/kludge called "multi segment files" which treated a
directory -- IIRC specially marked -- containing multiple actual files
as one big file, but support for this feature was apparently uneven,
working in some programs and not others. (My information on this is
secondhand; I was a lowly student user so my quota didn't reach even
to one full segment much less many and my access didn't extend to any,
er, "interestin g" file areas.)

Now I don't know if there was (ever) a C for Multics -- especially
considering its origin -- but if there was or were to be I can imagine
that it might fail for MSFs, and thus apparently for "large files".

- David.Thompson1 at worldnet.att.ne t
Nov 14 '05 #15
There was a C for Multics, late in its life, 1986, Multics release12.0,
documented in Honeywell manual HH07.

You are mistaken about files on Multics. Language library provided
files for PL/I, FORTRAN, COBOL, and C were all supported by the Multics
library I/O module vfile_, which supported various access modes on
objects stored in the file system, called "files." Small instances of
files were indeed stored as "single segment files" and larger ones as
"multi segment files." The system and the runtime library attempted to
make the transition from little files to big invisible to the
application program. As in many systems, it was possible to look behind
the curtain and write code that accessed underlying storage directly in
nonstandard ways. But standard conforming programs in the application
languages would work fine with files of sizes larger than 1MB.

Nov 14 '05 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2266
by: Phil Powell | last post by:
// PROCESS XML CONTENT INTO DYNAMICALLY-NAMED ARRAYS foreach (array('mime', 'state', 'country') as $val) { $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($parser, ${$val . 'XML'}, ${$val . 'XMLArray'}, $tags); xml_parser_free($parser); $myXMLArray = ${$val . 'XMLArray'}; for ($i = 1; $i < @sizeof($myXMLArray) - 1; $i++) { if ($myXMLArray) {
7
1714
by: pescott | last post by:
I am still struggling to get some files uploaded to a database as BLOB data. I have 5 includes which allows the user to upload 5 files, numbered accordingly. However, there are script errors. Duhh, why else would I post? Well, here goes: CODE $adres = trim (htmlspecialchars($_POST)); $verkocht = trim (htmlspecialchars($_POST)); $form_description1 = trim (htmlspecialchars($_POST));
4
5638
by: Jens Mittag | last post by:
Hi! In my code, I have an array of a structure, which I want to save to a binary file. When the array is just created, everything works fine, but when I change contents of the array, saving results in a file, which doesn't hold the information of the changed array anymore. I dont know why. Here is the code: /*
2
22612
by: Potiuper | last post by:
Question: Is it possible to use a char pointer array ( char *<name> ) to read an array of strings from a file in C? Given: code is written in ANSI C; I know the exact nature of the strings to be read (the file will be written by only this program); file can be either in text or binary (preferably binary as the files may be read repeatedly); the amount and size of strings in the array won't be known until run time (in the example I have it in...
1
8121
by: Alex | last post by:
Hello, I'm trying to write a little php script to transfert some files from a server to clients (web/http). It's working fin with small files. But transfering big files (try on 1Gb) failed! The transfert is stoped randomly (sometimes at 25%, sometimes at 75%,...). And I don't understand why?! :/
7
2653
by: lawrence k | last post by:
I've got a music studio for a client. Their whole studio is run with Macintosh computers. Macintosh computers allow file names to have open white spaces, such as "animal hospital.mp3". I have a download script, so customers on the website can download MP3s to their harddrive (rather than merely listen to it in their browsers):
4
3373
by: Giacomo | last post by:
Hello.. i'm using php on linux --version: PHP 5.2.5 (cli) (built: Apr 25 2008 18:40:41) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies and i'm experiencing unexpected behavior using fread with a binary file. Look at this code: i have a jpeg image of 2290 bytes long, but fread cannot read it correctly, like fgetc does:
13
10454
by: rohit | last post by:
Hi All, I am new to C language.I want to read integers from a text file and want to do some operation in the main program.To be more specific I need to multiply each of these integers with another set of integers stored in an array.It would be a great help if you could provide some code for it.I tried the function fscanf but by that I am able to read only the first integer of the text file.Please help me.
45
4466
by: Dennis | last post by:
Hi, I have a text file that contents a list of email addresses like this: "foo@yahoo.com" "tom@hotmail.com" "jerry@gmail.com" "tommy@apple.com" I like to
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10419
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10147
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9987
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9023
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5424
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5552
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4100
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3709
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.