|
What`s your code at your file closing. I think that`s where the problem is.
<italic>Work hard and a bit of luck is the key to success.
|
|
|
|
|
Hi,
Here is the code.
FILE *fp = fopen(this->output,"w");
fprintf(fp,"8\n");
for(rc=0;rc<9;rc++)
for(gc=0;gc<9;gc++)
for(bc=0;bc<9;bc++) {
lut[0][rc][gc][bc] = (lut[0][rc][gc][bc]>255)?255:lut[0][rc][gc][bc];
lut[1][rc][gc][bc] = (lut[1][rc][gc][bc]>255)?255:lut[1][rc][gc][bc];
lut[2][rc][gc][bc] = (lut[2][rc][gc][bc]>255)?255:lut[2][rc][gc][bc];
fprintf(fp,"%d %d %d\n",lut[0][rc][gc][bc],lut[1][rc][gc][bc],lut[2][rc][gc][bc]);
}
fclose(fp);
When my MFC application still runs, Iam able to open the file in dos prompt, but not in any of WIN32 application or in my own MFC application.
Am still not getting it. Could you please help me out, if you have the answers.
Thanx
Mughi
|
|
|
|
|
Hi,
The file was opened somewhere else (for other module) and was not closed. I had to track down the whole flow of the application and had the problem solved. Thats been a silly mistake and sorry for the inconvenience caused. Thanks for your support.
Thanx
Mughi
|
|
|
|
|
close the file before reopening it
TOXCCT >>> GEII power
|
|
|
|
|
I have a Pro*C application being developed on windows.
I have 2 functions, one which connects to the oracle database and the second function to update a table.
The first function connection()works fine (sucessfully connects to the DB).But when i try to update the table by calling the update() immediately after checking the success return value from the connect(), i get the error message
"ORA-01012: not logged on"
What is the problem?Is the session killed?
Please help.
Thanks
|
|
|
|
|
I'm working on an application that needs (mostly-sequential) access as fast as possible to a very large file (in excess of 1 GB, most likely in the range of 2-3 GB), so loading it to all to memory first is going to hurt more than it will help. I will be processing all of it, in a mostly (but not entirely - I may have to back-track a small amount on every iteration) sequetial manner, and performance is a key objective.
So my question is - am I better off writing (or finding) a file accessor class that explicitly caches the data to a buffer in (presumably) fixed amounts, or does the CFile (or underlying fread etc.) access functions take care of this situation in a reasonably efficient manner? (enough such that the overhead of secondary caching doesn't defeat the entire purpose?)
And if not, do you know of any already written libraries designed to handle this situation?
Thanks,
Tim
|
|
|
|
|
To be a bit more specific, out of the 1+ GB file, I'll need to access a few thousand bytes at once, and then need to access those same few thousand bytes +/- a few hundred (ie, my initial offset will be in the same ballpark, but not exactly the same as the first time).
Thanks,
Tim
|
|
|
|
|
|
Solution Title: COleDateTime
Date Asked: 12/01/2003 05:55AM PST
Date Answered: 03/30/2004 02:18AM PST
Hi
I am having some difficulty with the COleDateTime class in that I have a
DateTimePicker ctrl (m_date) and I am trying to initialise
it to the current time. from msdn help I have
DoDataExchange
DDX_DateTimeCtrl(pDX, IDC_LOG_DATE_PICKER, m_date);
Dialog Init
m_date = COleDateTime::GetCurrentTime();
Every time the dialog loads I get an error about "winCtrl5.cpp". I have traced it
and the above line is causing the problem.
Why? I had this working on Friday!
|
|
|
|
|
Is there a component gallery in VC++.net ( 2002 version ) ?
Thanks.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I am having trouble with the "Process-wide api spying" article by Anton Bassov. Here is the code:
HMODULE hMod = GetModuleHandle("kernel32.dll");
if (hMod == NULL)
MessageBox(NULL,"could not load dll","error",MB_OK);
else
{
IMAGE_DOS_HEADER * dosheader=(IMAGE_DOS_HEADER *)hMod;
IMAGE_OPTIONAL_HEADER * opthdr =(IMAGE_OPTIONAL_HEADER *) ((BYTE*)hMod+dosheader->e_lfanew+24);
IMAGE_IMPORT_DESCRIPTOR * descriptor=(IMAGE_IMPORT_DESCRIPTOR*)(BYTE*)hMod + opthdr->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress;
while(descriptor->FirstThunk)
{
char*dllname=(char*)((BYTE*)hMod+ descriptor->Name);
IMAGE_THUNK_DATA* thunk=( IMAGE_THUNK_DATA*)((BYTE*) hMod + descriptor->OriginalFirstThunk);
int x=0;
while(thunk->u1.Function)
{
char*functionname=(char*)((BYTE*) hMod + ( DWORD)thunk->u1.AddressOfData+2);
MessageBox(NULL,functionname,"function",MB_OK);
DWORD *IATentryaddress=( DWORD *)((BYTE*) hMod + descriptor->FirstThunk)+x;
x++; thunk++;
}
descriptor++;
}
}
It is crashing at run-time, saying that it cannot read from desciptor. Anyone have any idea what the problem is? Any help is appreciated.
-Dev578
|
|
|
|
|
Hi,
I am working on an MDI program and I am not using DOC/View architecture because its too slow. So I kind of made my own version that creates CMDIChildWnd derived objects during runtime then calling ->Create to create and show the window in the main frame.
Right now I am closing the windows by sending WM_CLOSE message to the object. However, I can't seem to delete the object explicitly. Visual C++ will break with an exception if I do.
I read the code project tutorial "Creation of Multiple Dynamic Views" and it says near the bottom that I can't delete it explicitly and must let the main frame close and call the destructors automatically.
http://www.codeproject.com/docview/dynviews.asp#xxxx[^]
Now after extended use without closing the main frame, will there be a memory leak in my program? If so, how do I get around this so I can delete my memory right away.
Thanks in advance!
|
|
|
|
|
How can I get the info out of my VS_VERSION_INFO (strings like ProductVersion, CompanyName)? I know it's probably very simple, but I've never done it before and I can't seem to find any documentation on it. everything I've found is talking about getting the version info for another .exe, but not yours!! Any help is appreciated. Thanks in advance!
[insert witty comment here]
bdiamond
|
|
|
|
|
|
Take a look at the GetFileVersionInfo , GetFileVersionInfoSize and VerQueryValue functions.
|
|
|
|
|
thanks for this useful help
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
yeah, I found a piece of code here on CP to do what I needed. I think it's simpler to just #define VERSION_NUMBER _T("1.8") as I've been doing. That seems like an awful lot of work to get the version number info from your own app. I think it should be a member of CWinApp, personally.
theApp.m_strVersionNumber or something like that. Thanks, though.
[insert witty comment here]
bdiamond
|
|
|
|
|
Anybody knows how to avoid the user to edit the date in a datetimepicker control ?
I only want the user to be able to open the calendar when he/she clicks on the arrow and pick a date from that month calendar, but not be able to change the date in the edit fields.
-------------------------------
[Wednesday, September 22, 2004] <- not allow to change in that portion
-------------------------------
| sun mon tue wed thu fri sat |
| 1 2 3 4 5 6 7 | <- ok to use the popop calendar
| 8 9 10 11 12 13 14 |
| 15 16 17 18 19 20 21 |
| 22 23 24 25 26 27 28 |
| 29 30 |
-------------------------------
thanks.
Lou
* how do you like my datetimepicker control ?
|
|
|
|
|
in MSDN this is written :
"To jump to a page other than the next one, return the identifier of the dialog to be displayed."
should it be something like that :
LRESULT CMyPropertyPage1::OnWizardNext()
{
BOOL b = m_Choose.GetCheck();
if ( m_Choose.GetCheck() == TRUE )
return 1;
else
return 3;
}
to go to either page 1 or page 3 ?
because it doesn't seem to work ? Am I missing something ?
Thanks.
Max.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
"the identifier of the dialog" means the dialog resource ID, eg IDD_FINISHING_PAGE .
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Four fonts walk into a bar. The bartender says "Hey - get out! We don't want your type in here."
"That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."
-- Buffy
|
|
|
|
|
|
Hi there,
I have recently finished a collection of classes which provide support for database processing. The only problem though is the classes use the (old-deprecated) ODBC API.
Some time ago I was told ADO data source connectivity is a much better approach because of its ease of use, speed and so forth. This made me think about updating (or actually rewritting) the entire collection so that it can support the latest in what regards to datasource connectivity.
But I have been doing some reading and would like to ask you some questions:
- doesn't ADO use OLEDB? And if so, should I not be thinking about supporting OLEDB rather than ADO as it would create an additional layer between the ODBC driver and the App?
- in what concerns compatibility and speed, what is, in your own opinion, the platform I should be aiming for?
Thank you very much,
David
|
|
|
|
|
I think the time needed to load the data from hard disk takes much longer than the time to process requests and transfer them via ODBC.
I myself use ODBC, too, and I don't see any reason why I shouldn't do so.
Don't try it, just do it!
|
|
|
|
|
Yes, ADO uses OLEDB. Using OLEDB will give you the most functionality and performance. Consider using ATL wrapper classes, they'll make it easier. For example:
<br />
HRESULT hr = spDataInitialize.CoCreateInstance(CLSID_MSDAINITIALIZE);<br />
if(FAILED(hr)) return 1;<br />
<br />
hr = spDataInitialize->GetDataSource(NULL, CLSCTX_INPROC_SERVER, pwszConnectionString,<br />
IID_IDBInitialize, reinterpret_cast<IUnknown**>(&spDBInitialize));<br />
if(FAILED(hr)) return 1;<br />
<br />
hr = spDBInitialize->Initialize();<br />
if(FAILED(hr)) return 1;<br />
<br />
ATL::CComQIPtr<IDBCreateSession> spDBCreateSession = spDBInitialize;<br />
if(!spDBCreateSession) return 1;<br />
<br />
hr = spDBCreateSession->CreateSession(NULL, IID_IDBCreateCommand, reinterpret_cast<IUnknown**>(&spDBCreateCommand));<br />
if(FAILED(hr)) return 1;<br />
<br />
hr = spDBCreateCommand->CreateCommand(NULL, IID_ICommand, reinterpret_cast<IUnknown**>(&spCommand));<br />
if(FAILED(hr)) return 1;<br />
<br />
ATL::CComQIPtr<ICommandStream> spCommandStream = spCommand;<br />
if(!spCommandStream) return 1;
|
|
|
|
|
Let's try this again, this time with the angle brackets..
HRESULT hr = spDataInitialize.CoCreateInstance(CLSID_MSDAINITIALIZE);<br />
if(FAILED(hr)) return 1;<br />
<br />
hr = spDataInitialize->GetDataSource(NULL, CLSCTX_INPROC_SERVER, pwszConnectionString,<br />
IID_IDBInitialize, reinterpret_cast<IUnknown**>(&spDBInitialize));<br />
if(FAILED(hr)) return 1;<br />
<br />
hr = spDBInitialize->Initialize();<br />
if(FAILED(hr)) return 1;<br />
<br />
ATL::CComQIPtr<IDBCreateSession> spDBCreateSession = spDBInitialize;<br />
if(!spDBCreateSession) return 1;<br />
<br />
hr = spDBCreateSession->CreateSession(NULL, IID_IDBCreateCommand, reinterpret_cast<IUnknown**>(&spDBCreateCommand));<br />
if(FAILED(hr)) return 1;<br />
<br />
hr = spDBCreateCommand->CreateCommand(NULL, IID_ICommand, reinterpret_cast<IUnknown**>(&spCommand));<br />
if(FAILED(hr)) return 1;<br />
<br />
ATL::CComQIPtr<ICommandStream> spCommandStream = spCommand;<br />
if(!spCommandStream) return 1;
|
|
|
|