473,408 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

How to Read very large file with formatting (file size > 1 GB)

Dear All,

Can anybody help me to read a very large file? and I need to maintain the formatting. The file size starts from 1 GB.

Is there any built-in library?

Thanks in advance
Dec 14 '10 #1
4 2549
weaknessforcats
9,208 Expert Mod 8TB
As long as you read the file onto the heap there should be no problem unless your system restricts maximum heap size per process. Just read the file.
Dec 14 '10 #2
donbock
2,426 Expert 2GB
You may need to open it as a binary file. It depends on the file format.

If you can't allocate a single heap buffer large enough for the entire file then you will be forced to look through the file a block at a time, trading reduced memory usage for more complicated software and increased execution time.
Dec 14 '10 #3
Thank you for your guidance.
One more question...
my 1GB file has 5 columns. first column contains integer and second onwards float or double or integer.

e.g
32, 5.12759588393658e-030, 45.0, 0, 50.0

Please tell an efficient way to access each data. Could you share any code?

Thanks in advance
Dec 15 '10 #4
donbock
2,426 Expert 2GB
A 1GB file formatted as you describe is approximately 200,000 lines. Would you rather end up with a 1GB buffer holding the text of the file or four 200,000-element arrays holding the numeric values pulled from the file?

If you want the numeric values then you only need to repeatedly read a single line, parse it into the four numbers, and add that set of numbers to the arrays.

You should use a small test file with only a few lines to test your parsing software.
Dec 15 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: lawrence | last post by:
Using <INPUT type"file" runat="server"> to upload a file. When the file size is too large I get a "page cannot be display" error. Thats cool I'm down with that. But is there a way to check for...
9
by: junw2000 | last post by:
How to quickly read large C++ code with hundreds of classes, thousands of lines? Thanks. Jack
10
by: vunet.us | last post by:
What is the workaround of passign a parameter to any included asp file: <!-- #Include File="file.asp" --> This obviously does not work: <!-- #Include File="file.asp?id=123" --> Thank you
13
by: liujiaping | last post by:
Hi, all. I have a dictionary-like file which has the following format: first 4 column 7 is 9 a 23 word 134 .... Every line has two columns....
3
by: clairePuj | last post by:
Hi everybody, Please can you tell me how can I read large data file (> 15 millions line) in C/C++ languge. Thanks for your help, Claire
2
by: Kevin Ar18 | last post by:
I posted this on the forum, but nobody seems to know the solution: http://python-forum.org/py/viewtopic.php?t=5230 I have a zip file that is several GB in size, and one of the files inside of it...
4
by: nano2k | last post by:
Hi For some purposes, I need to create a new binary file and to allocate a fixed length for that file on the disk. I need something like File.Create(string fileName, long initialSizeInBytes)....
10
by: BostonNole | last post by:
Using Visual Studio 2005, .NET 2.0 and VB.NET: I am looking for the fastest possible way to import a very large fixed width file (over 6 million records and over 1.2 GB file size) into a...
4
by: jx2 | last post by:
hi everyone i'm trying to read data from CSV file file is about 1MB (or bigger) i figured out how to read it quickly from the disc but it takes 3000 milliseconds to change it into arrays so my...
6
N002213F
by: N002213F | last post by:
I have a Java text reader program that can easily read small text, but seems fails to read larger files >20MB. It seems to truncate the contents it reads. I there a way of making sure all the data...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.