what is the maximum size
-
Dear friends, small Clarification what is the maximum size of byte array? if i write like this ( for 2 gb file will it handle?) byte[] bdata = System.IO.File.ReadAllBytes("MyFileName.doc"); Why the Stream.Read(buffer[],offset,"length") "Length" as "int" not a "double" (if it more then 2gb File How can i specify the length "becase the integer maximum value is (2gb -1 byte)... if i want to read the last 10 bytes in more then 2gb file how can i read? any idea? link?.. By joe.I
-
Dear friends, small Clarification what is the maximum size of byte array? if i write like this ( for 2 gb file will it handle?) byte[] bdata = System.IO.File.ReadAllBytes("MyFileName.doc"); Why the Stream.Read(buffer[],offset,"length") "Length" as "int" not a "double" (if it more then 2gb File How can i specify the length "becase the integer maximum value is (2gb -1 byte)... if i want to read the last 10 bytes in more then 2gb file how can i read? any idea? link?.. By joe.I
Take a look at the StreamReader Class.
-
Dear friends, small Clarification what is the maximum size of byte array? if i write like this ( for 2 gb file will it handle?) byte[] bdata = System.IO.File.ReadAllBytes("MyFileName.doc"); Why the Stream.Read(buffer[],offset,"length") "Length" as "int" not a "double" (if it more then 2gb File How can i specify the length "becase the integer maximum value is (2gb -1 byte)... if i want to read the last 10 bytes in more then 2gb file how can i read? any idea? link?.. By joe.I
Please don't read a 2gb file all at once. Thats just insane. Read it a little bit at a time, say, 1 mb or 10 mb, or whatever. Like the other guy said, check out StreamReader.
-
Take a look at the StreamReader Class.
Thank you friend, Thanks for Your replay ...... i made small mistake .... :-\ thank you. by joe
-
Please don't read a 2gb file all at once. Thats just insane. Read it a little bit at a time, say, 1 mb or 10 mb, or whatever. Like the other guy said, check out StreamReader.
Thank you friend, Thanks for Your replay ...... i made small mistake .... :-\ i am not reading 2G file at time i am reading 100kb at time ...anyhow thanks for your suggestion. thank you. by joe
-
Dear friends, small Clarification what is the maximum size of byte array? if i write like this ( for 2 gb file will it handle?) byte[] bdata = System.IO.File.ReadAllBytes("MyFileName.doc"); Why the Stream.Read(buffer[],offset,"length") "Length" as "int" not a "double" (if it more then 2gb File How can i specify the length "becase the integer maximum value is (2gb -1 byte)... if i want to read the last 10 bytes in more then 2gb file how can i read? any idea? link?.. By joe.I
-
Dear friends, small Clarification what is the maximum size of byte array? if i write like this ( for 2 gb file will it handle?) byte[] bdata = System.IO.File.ReadAllBytes("MyFileName.doc"); Why the Stream.Read(buffer[],offset,"length") "Length" as "int" not a "double" (if it more then 2gb File How can i specify the length "becase the integer maximum value is (2gb -1 byte)... if i want to read the last 10 bytes in more then 2gb file how can i read? any idea? link?.. By joe.I
Hi, AFAIK array sizes are limited to something like 2G-1. However, assuming you only need part of the content of a binary (i.e. non-text) file, you can: - get the File.Length, which is a long; - get a stream for reading the file, with File.Open; - seek a position in the file, say length-10, using FileStream.Seek; - and read part of the file into an array, using FileStream.Read; - finally close/dispose everything. So for getting the end of the file, there is no need whatsoever to read everything! :)
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
-
IIRC it depends on 32 vs 64 bit. But, in any case, will you really be happy if one program fills up all of most (or at least a sizable chunk) of your RAM? Btw, surely you mean a
long
not adouble
Thanks for your replay....
harold aptroot wrote:
or at least a sizable chunk
that's what i was trying ....
harold aptroot wrote:
surely you mean a long not a double
yes i was mistaken that is long Thank you so much :) :) :) :) by joe
-
Hi, AFAIK array sizes are limited to something like 2G-1. However, assuming you only need part of the content of a binary (i.e. non-text) file, you can: - get the File.Length, which is a long; - get a stream for reading the file, with File.Open; - seek a position in the file, say length-10, using FileStream.Seek; - and read part of the file into an array, using FileStream.Read; - finally close/dispose everything. So for getting the end of the file, there is no need whatsoever to read everything! :)
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Thank you friend.... i was doing the same .... thanks for the explantion ... i did not notice that Seek position is (Long)
Luc Pattyn wrote:
seek a position in the file, say length-10, using FileStream.Seek
now my program works fine ... :) :) :-D by joe