|
Following is the code snippet i am working with.
miNumDataFile denotes number of datafiles
msarrDataFile[iloop] denotes the file path and name.
I am opening around 3000 fines in binary mode and
reading all the records in each file using fread. total file size
around 187mb with 1366218 rows.
its a simple c exe.
on the first run it takes 48 secs.
on the seond run it takes 2 secs!!!!!!!!!.
my question is why is happening. each time i reboot my pc
the same phenomenon happens. WHY??????
for(int iloop=0;iloop
|
|
|
|
|
The OS does a caching for you
does it bother you?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Thanks Papa for your reply.
I was not sure what was happening.
Now even if the OS is doing the caching part, I have 2 questions.
Will this happen in every OS. and further more some times it takes 1-2 secs to read files (total size 200 MB). that whats bothers me. 1/2 secs is really low, for reading and processing 200MB file wont you think!!
Anyway i am planing it run this component on a web sever. and a page will call this to show the results of this component.
thats why i am so worried about this thing..
Thanks a lot anyway...
Apratim
|
|
|
|
|
hi,
i created a simple editbox derived from CEdit class. its working , but clicking in the edit box sets out the devil.
The program shuts down after showing the message 'Debug Assertion Failed " Abort-Retry-Ignore.
Another problem is that i can't type characters more than the length of the editbox.
I wrote a message to handle the keypress event, using ON_EN_CHANGE(IDC_ED,OnEditKeyDown). but am not getting the 'enter' key.
the edit box is deleted in the killfocus event..
CAN ANYBODY HELP PLEASE ?
thanks in advance..
---------------- here goes the code-----------
-----edit box creation on pressing F4 key-----
case VK_F4:
{
CMainFrame* pMainWnd = (CMainFrame*) AfxGetMainWnd();
pEdit = new CEdit;
pEdit->Create(ES_AUTOVSCROLL | ES_WANTRETURN | WS_CHILD | WS_VISIBLE |WS_TABSTOP | WS_BORDER, CRect(0,col+(m_nCurSel*2),75,col+(m_nCurSel*2)+17), this,
IDC_ED);
pEdit->SetLimitText(50);
pEdit->SetFocus();
}
------ function that receives keypress---
void CMarketWatchView::OnEditKeyDown(UINT nChar)
{
static const MSG* pMsg = GetCurrentMessage();
if(pMsg->wParam==0x0D) //checkfor enter key
{
AfxMessageBox("Enter key");
- other code here-
}
pEdit->SetFocus();
}
---------lost focus function for the edit box ----
void CMarketWatchView::OnEditKillFocus()
{
char buf[50];
pEdit->GetWindowText(buf,49);
--other code here--
Invalidate(FALSE); //redraw
delete pEdit;
}
|
|
|
|
|
maybe you post the complete code here?
|
|
|
|
|
b coz, i want the edit box to be dstroyed when it loses the focus.
the user can press F4 key again to create it.
it will b good if edit box disappears, when user hits Enter key.
thanks
|
|
|
|
|
-----edit box creation on pressing F4 key-----
case VK_F4:
{
CMainFrame* pMainWnd = (CMainFrame*) AfxGetMainWnd();
pEdit = new CEdit;
pEdit->Create(ES_AUTOVSCROLL | ES_WANTRETURN | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER,
CRect(0,col+(m_nCurSel*2),75,col+(m_nCurSel*2)+17), this, IDC_ED);
pEdit->SetLimitText(50);
pEdit->SetFocus();
}
------ function that receives keypress---
void CMarketWatchView::OnEditKeyDown(UINT nChar)
{
static const MSG* pMsg = GetCurrentMessage();
if(pMsg->wParam==0x0D) //checkfor enter key
{
AfxMessageBox("Enter key");
- other code here-
}
pEdit->SetFocus();
}
---------lost focus function for the edit box ----
void CMarketWatchView::OnEditKillFocus()
{
char buf[50];
pEdit->GetWindowText(buf,49);
--other code here--
Invalidate(FALSE); //redraw
delete pEdit;
}
|
|
|
|
|
Why are you killing the edit in the OnEditKillFocus?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I'd guess that they want to implement 'in-place' editing of text in a view, and clicking somewhere else is intended to complete/cancel the edit, collapsing the box.
Of course, that's only based on a glimpse of the code fragment, so I could be completely wrong
Steve S
|
|
|
|
|
I meant why not hiding it?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
OIC. That's a good question...
Steve S
|
|
|
|
|
Hi all,
How to resize/place the activeX control in a container window, By default the
activeX control is resized to Full window size in which it is hosting how i can avoid that.
Thanks in Advance,
Abhishake
|
|
|
|
|
Why is iostream.h & fstream.h missing from VC++.NET include folders.
If I copy the same files from VC6.0 then I get errors in those files.
What can I do, where can I get those header files and if not what headers can I use instead of fstream.h
We have a mathematician, a different kind of mathematician, and a statistician!
|
|
|
|
|
try to include instead :
#include <iostream>
#include <fstream>
TOXCCT >>> GEII power
|
|
|
|
|
"iostream.h" and "fstream.h" are not part of C++. Look at "iostream" and "fstream" and then the 'std::' scope.
#include <iostream>
#include <iomanip>
#include <fstream>
void SomeFuncToReadFile ( const char * sFile )
{
std::ifstream in ( s ) ;
if ( !in )
{
std::cerr << "Couldn't open input file : " << s << std::endl ;
return ;
}
in.unsetf(std::ios::skipws) ;
}
Paul
|
|
|
|
|
I currently do:
_stscanf(string, L"%x", &number);
it doesn't seem like any of the atoi/l functions can handle hexa-decimal input,
any suggestions for something cleaner, or is as clean as it gets ?
|
|
|
|
|
do this :
<font style="color:blue;">char</font> str[2]; <font style="color:green;">
<font style="color:blue;">unsigned char</font> ucConvertedNumber,
MSB, <font style="color:green;">
LSB; <font style="color:green;">
LSB = ((str[1] >= <font style="color:purple;">'0'</font>) && (str[1] <= <font style="color:purple;">'9'</font>)) ? str[1] - <font style="color:purple;">'0' </font>:
((str[1] >= <font style="color:purple;">'a'</font>) && (str[1] <= <font style="color:purple;">'f'</font>)) ? str[1] - <font style="color:purple;">'a' </font>+ 10 :
((str[1] >= <font style="color:purple;">'A'</font>) && (str[1] <= <font style="color:purple;">'F'</font>)) ? str[1] - <font style="color:purple;">'A' </font>+ 10 : -1; <font style="color:green;">
<font style="color:green;">
MSB = ((str[0] >= <font style="color:purple;">'0'</font>) && (str[0] <= <font style="color:purple;">'9'</font>)) ? str[0] - <font style="color:purple;">'0' </font>:
((str[0] >= <font style="color:purple;">'a'</font>) && (str[0] <= <font style="color:purple;">'f'</font>)) ? str[0] - <font style="color:purple;">'a' </font>+ 10 :
((str[0] >= <font style="color:purple;">'A'</font>) && (str[0] <= <font style="color:purple;">'F'</font>)) ? str[0] - <font style="color:purple;">'A' </font>+ 10 : -1; <font style="color:green;">
<font style="color:green;">
MSB = MSB << 4;
ucConvertedNumber = MSB | LSB;
you've got it...
you can nox do :
printf(<font style="color:purple;">"Decimal form :%d\n"
"Hexadecimal form :%x\n"</font>,
ucConvertedNumber,
ucConvertedNumber);
TOXCCT >>> GEII power
|
|
|
|
|
long strtol( const char *nptr, char **endptr, int base );
acString
strtol(acString, NULL, 16);
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
this is the function i was looking for
|
|
|
|
|
ok for a function, but understand what it does because it isn't a standard function...
TOXCCT >>> GEII power
|
|
|
|
|
Nice joke.
God is Real, unless declared Integer.
|
|
|
|
|
ok, i was thinking of another.
just verified.
TOXCCT >>> GEII power
|
|
|
|
|
hi ppl,
I am creating a Client server application using Asyncsockets using MFC.
my application is running well on the local server.
but the problem starts when it's client side is used on other computers on lan
Like
for the first time the client connects to the server every thing goes on smoothly but when the connection closes from the client side the server closes all the connection but on the client side the connection goes to the FIN_WAIT2 and reamins there and no message can be sent from there on so the application halts.
I donn know what to do help me?
|
|
|
|
|
ok i think i also faced similar situation when i encounter this problem.
the solution is that you override the function OnClose()
of AsyncSocket of MFC
and In OnClose()
close the socket connectiong socket ok
i think it work
Alok Gupta
visit me at http://alok.stormpages.com
|
|
|
|
|
hi alok,
thanks a lot for ur reply,
but eventually i figured out my problem was not related with opening or closing but what i am using is ASyncSockets which are by default NON blocking sockets as a results the connection closes automatically if there is no buffer recieved so i used CSocket class ie a Blocking Socket class as a result untill unless the Buffer is recieved the connection is alive.
thanks a lot again
|
|
|
|