|
hi everyone,
this is my problem:
I have a huge binary file.I have my application:"software",since which i want to import the binary file.
but the file is huge:4gig. so my application crashes when i try to import it.and i get an exception: outofmemory...
what can i do to split the file, and to load it piece by piece into memory.
PS:after i omport the file into memory i have to use its seismic data to do some 3D simuations.
someone has an idea?
thanks.
assia
hgfh
|
|
|
|
|
How are you importing the file? What functions/class(es) are you using?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
Hi Mark,
Thanks for you answer.
I lived the office. I will send you the pieces of code tomorrow.
Thanks.
assia
hgfh
|
|
|
|
|
Hello everyone,
As I said I have 4 giga of memory and the file is 5 giga.I use windows Vista64.
and VStudio2005.
Does the serialization work in this case?
What to do to load the file piece by piece?
Is it possible de developp my own serializer ? if yes, can you give me an idea please about how to do it?
Here is my function:
Sine my main class I call this import for differents files, and it is ok when they are not huge.
Here is my function:
FileFormat::openImport(CFile &file, const CString& filename, bool is_binary) const {
FileFormat *self = (FileFormat *) this;
self->filename_ = filename;
self->in_import_ = true;
self->current_line_ = 0;
CFileException file_exception;
if (is_binary) {
if (!file.Open(filename, CFile::modeRead | CFile::typeBinary | CFile::shareDenyWrite, &file_exception))
return openError(file_exception, filename, name_);
}
else {
if (!file.Open(filename, CFile::modeRead | CFile::typeText | CFile::shareDenyWrite, &file_exception))
return openError(file_exception, filename, name_);
}
return true;
}
Thanks.
assia
hgfh
|
|
|
|
|
You may want to look into using a File Mapping[^] so you can access the
entire huge file without loading the entire file into memory at once.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
This link may or may not apply to your situation but it is interesting:
http://www.dansdata.com/askdan00015.htm[^]
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
hai
Can you please holp me reagarding where can i find the implementation of CRC12,CRC16 algorithms in pure c or c++.
KIRAN PINJARLA
|
|
|
|
|
kiran.pinjarla wrote: where can i find the implementation of CRC12,CRC16 algorithms in pure c or c++.
You mean somewhere other than the internet?
|
|
|
|
|
I am recording to current time, and compare with the old time which stored in a file. but here t4 is always one digit less.
for example, when I check file end.txt and start.txt, t4 is 22284, and t3 is 21975, no problem.
but when I calculate and output differ, it shows 2228-21975=-19747. t4 is wrong! what is the problem here?
<br />
int differ=0;<br />
int t3=0;<br />
int t4=0;<br />
time_t t1,t2;<br />
FILE * pFile; <br />
<br />
(void) time(&t2);
t4=(int)t2;<br />
pFile = fopen ("/root/pclinq/end.txt","r+");<br />
fprintf (pFile, "%d",t4);
fclose (pFile);<br />
<br />
<br />
pFile = fopen ("/root/pclinq/start.txt","r+");<br />
fscanf (pFile, "%d", &t3);
fclose (pFile);<br />
<br />
differ=t4-t3;<br />
<br />
<br />
printf("differ is %d-%d=%d\n",t4,t3,differ);
(solved)it turns out the last digit was a remaining one, for example,2228 is the real number recorded this time
-- modified at 8:51 Tuesday 17th July, 2007
|
|
|
|
|
bloodwinner wrote: (solved)it turns out the last digit was a remaining one, for example,2228 is the real number recorded this time
and I guess the more appropriate open mode for writing a file is "w+" ...
|
|
|
|
|
Dear Sir,
I am using Visual C++ NET 2005.
How can I know the character(if it's 1,A... etc) that I strike when I am in the textbox field in the Keydown event ?
|
|
|
|
|
KeyEventArgs.KeyCode and KeyEventArgs.KeyChar
|
|
|
|
|
Dear Sir,
I am using Visual C++ NET 2005.
|
|
|
|
|
mikobi wrote: I am using Visual C++ NET 2005.
Cool, do you have a question?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
How to specify out parameters in CLI/C++ like we do in C#?
|
|
|
|
|
I expect there is no specifically out parameters and in parameters in c++. But for out parameters we should use the reference variable or pointer variable. Like we need to use call by ref concept.
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
To create an out-only parameter, you need to use the Out Attribute and a tracking reference:
using namespace System;
using namespace System::Runtime::InteropServices;
public ref class Foo
{
public:
void Func([Out] String^% value)
{
value = "Hello";
}
};
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Thanks George!
|
|
|
|
|
Oh. Really Thanks.
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
Is the static member variable in class will same for all objects of that class?
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
yes static member variables are same for all objects of the class. As the scope of static member variable is class level not of object level. Each object of the class can access and share static member of class.
Static member is accessed via class name and not by object name, like
//static member accessment
className.staticmember = someValue
//object level variable.
objName.objMember
-shoaib-
|
|
|
|
|
hello,
I have declared a classe, when i creat instance of this classe, it work but when I call a thread it does not work
Thread ^trd;
ThreadStart ^myThreadDelegate = gcnew ThreadStart(this, &BHIDS00::Form1::rep);
trd = gcnew Thread(myThreadDelegate);
trd->IsBackground = true;
trd->Start();
avec rep() { .....................} est une méthode que je veux appelé
or in this methode there are listView->items->add(".."); with thread it doesn't display in listview, and I do rep();
how i do work my methode using thread ???
Merci beaucoup
|
|
|
|
|
|
Cool! I have't used forms yet, but I filed that away for future reference.
Thanks!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
When you see System::String used with “xxx” in some text or example you almost always see the ‘L’ macro in from of the text (L”xxx”). However if I do not use the ‘L’, It seems to have no affect to my String values. Am I missing something?
String ^MyText = "Blah";
String ^MyOtherText = L"Blah";
Same right?
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|