|
prasad_som wrote: You need to call CFile::Close before CArchive::Close.
You are wrong. CArchive does not close the file object.
This is the source code...
void CArchive::Close()
{
ASSERT_VALID(m_pFile);
Flush();
m_pFile = NULL;
}
|
|
|
|
|
I think you replying to my previous reply.
Haven't you seen I've already modified it?
|
|
|
|
|
prasad_som wrote: I think you replying to my previous reply.
Haven't you seen I've already modified it?
No I didn't see but still why are you saying that CFile::Close should be called before CArchive:Close . Why what's the reason?
|
|
|
|
|
You are right.
|
|
|
|
|
Since the following snipped of code works fine on my system:
CFile file;
MyObject obj;
file.Open("foo.txt",CFile::modeWrite|CFile::modeCreate);
CArchive ar(&file, CArchive::store);
obj.Serialize(ar);
ar.Close();
file.Close();
hope that helps.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Yes. I was wrong.
It was not this fp.Close() which was causing the exception.
It was another Close().
Anyhow learned a few new things.
Thank you all.
KIRAN PINJARLA
|
|
|
|
|
dear,
<pre></pre> tags are for posting code samples, not quotation, because you're breaking the page...
thank you
|
|
|
|
|
|
hello all
i want any widget who can rotate to carry out my function in a mfc project
thanks in advance
henry
|
|
|
|
|
Could you decipher your post for us (simple people) please...
Regards
|
|
|
|
|
Hi All,
we have developed a service which will be using ODBC Database connectiviy for fetching the data from database.when the system has restarted the service has to be started automatically...but it doesn't...it is unable to start because it is unable to find the ODBC connectivity...but once the system is started,when user starts it, it will be started....is that when the system is restarted and when it is starting the services till that time ODBC drivers are not installed?...can any one help me out regarding this
Mpk1979
|
|
|
|
|
You can set your service, depenendent on other service, that you feel need to run, for your service to start succesfully.
I dont know about database services, but you can identify by looking services explorer.
Once, set your service depend on other service, It will wait to start that service and then initiates its start process.
|
|
|
|
|
Just a thought, is your service running under Local Account?
In that case, you won't be able to connect over the network (since noone has logged on). And you wan't be able to connect to the DB (over the network).
Could this be the cause of your problem?
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Hi,
It shouldn't be the case, because Local account is not the one which is used to log in to the database.
I'm not quite certain, but MSDTC is probably what you're looking for. If you add it as dependency for your service, it should be working properly.
Regards
|
|
|
|
|
Hi
I want to convert my project into unicode enabled. so for this whether I have to convert all data type to unicode enabled or convert only those datatype that are releted to resources.
Thanks
M.Atul
|
|
|
|
|
Hi friends,
when i will debugg my project breakpoints are not setting properly.After debug i will get white color mark instead of red color.
Error message:One or more breakpoints cannot be set and have ben disabled.Program stop the execution of program.
These following setting i have done for debugger.
1)Project->setting->debug->server exe file path.
2)Project-> setting->c/c++->optimization->Disabled(debug)
3).........................-> debug info->Program database for edit and continue
After buliding i am not getting pojectname.pdb. but i am getting Old project .pdb file.I guess problem with .pdb file.I hope anybady having some idea.please share your ideas.
|
|
|
|
|
Generally, this happens, if no debug symbol loaded for code, you have set breakpoint for.
|
|
|
|
|
I have set breakpoint for one function called DocOpenOldStyle().But it doesn't matter for function.
May i know what type of setting i want to do?
|
|
|
|
|
What type of application, you are working with?
Make sure following things,
-You are using Debug configuration.
-If you are developing dll/COM add-in, its loaded in target exe correctly.
|
|
|
|
|
Hi Prasad,
Thanks for ur suggestions.
I am using Win32 appliaction, and Debug configuration.
I have loaded target exe file properly.I am sure about this things.
Inspite of these setting i am getting same error.
We are implementing new project in that Debugger is not working, but in another system Debugger is running properly. I do not understand what is the probelm?
|
|
|
|
|
Try a "Rebuild all"
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
"Rebuild all " dosent work.I have done it earlier.would please give other suggestions.
|
|
|
|
|
See the answer from prasad_som. Says it all.
I can think of two resons for not reaching the breakpoint:
1.
The code in question is commented out, or defined out.
2.
You are not doing a debug build.
If I'm wrong, (and a "Rebuild All" doesn't help), then I'm out of guesses.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Hi,
Thanks for your suggestions.
I got your second point.But i am sure that i am using Debug version of build.I clarify from
Build-> Setactive configuration option from my code.
But i didn't understand your First point clearly.Please explain briefly.
|
|
|
|
|
OK.
Assume you did wrote some code, i.e. a function.
Then you put a breakpoint in that function.
Later on you rewrote the entire function, but you didn't want to remove the first version of it.
So you commented out (or defined out) the function (with the breakpoint still there).
Now, the breakpoint cannot be reached, so VC++ will warn you and disable the breakpoint.
An example:
void class::func()
{
m_classvar = 0; // You out a breakpoint here
}
Now, you rewrite the function (and comment out the old version of it), like this (or with /* ... */):
(notdef is not defined)
#ifdef notdef
void class::func()
{
m_classvar = 0; // You out a breakpoint here
}
#else
// The rewritten function.
void class::func()
{
m_classvar = 4;
}
#endif
So, your breakpoint is set on a piece of code that will never be compiled, and hence, it will be disabled when you start your debugging session.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|