|
Thanks Hamid,
I think there are very few posts dedicated about WinDbg, not dedicated sub-forum which deals with WinDbg. Could you check again please? Please feel free to correct me if I am wrong.
regards,
George
|
|
|
|
|
Hi All,
I am not able to find out the solution of how to find out whether a file is ready to use or not. I have tried several ways to do this but unable to do the same, please refer me to some solution.
Regards,
Pankaj Sachdeva
There is no future lies in any job but future lies in the person who holds the job
|
|
|
|
|
Karismatic wrote: whether a file is ready to use or not.
What does you mean by this??
Regards,
Sandip.
|
|
|
|
|
What do you mean by file is ready?
Saurabh
|
|
|
|
|
I mean one process in writting a file which i want to access but before I open it i want to test whether it is written completely or not. I am using this code but it is not working properly
FileHandle = CreateFile (FileName,
GENERIC_READ,
0,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (FileHandle == INVALID_HANDLE_VALUE)
{
return (FALSE);
}
CloseHandle (FileHandle);
return TRUE
Regards,
Pankaj Sachdeva
There is no future lies in any job but future lies in the person who holds the job
|
|
|
|
|
Why don't you use some synchronization technique between the two processes??
Regards,
Sandip.
|
|
|
|
|
Hi,
I have encountered this really strange bug. For a new project I have split a old, working class and its member class into two single classes (functional, wrapper).
When I use the same code that has worked for years, it crashes with heap or stack corruption. I have narrowed the bug to the use of a function pointer in the wrapper class to a member of the functional class. When i add this pointer as a member of the wrapper class, the corruption happenes i don't even have to call it.
This is the code that does the woe.
int _tmain(int argc, _TCHAR* argv[])
{
functional oFun;
{
wrapper wrap(&oFun);
}
return 0;
}
When exiting the stack is corrupted.
The is the code of the wrapper class
--wrapper.h--
#pragma once
class functional;
class wrapper
{
public:
wrapper(functional* pFun);
~wrapper(void);
void (functional::*pExitFunction)();
functional* _pFun;
};
--wrapper.cpp--
#include "wrapper.h"
#include "functional.h"
wrapper::wrapper(functional* pFun)
{
_pFun = pFun;
pExitFunction = &functional::set_one;
}
wrapper::~wrapper(void)
{
(_pFun->*pExitFunction)();
}
This is the code of the functional class
--functional.h--
#pragma once
class functional
{
public:
functional(void);
~functional(void);
void set_one();
int _iData;
};
--functional.cpp--
#include "functional.h"
functional::functional(void)
{
_iData = 0;
}
functional::~functional(void)
{
}
void functional::set_one()
{
_iData = 1;
}
Why does the stack get corrupted?
I'm really stuck on this one, so any pointers would help me a lot.
Learn from the mistakes of others, you may not live long enough to make them all yourself.
|
|
|
|
|
Are you sure this code has a bug? I coudn't find any problem with the code so I decide to run it myself and it runs perfectly.
BadKarma wrote: void (functional::*pExitFunction)(); // the addition of this line causes the corruption // even if you don't use it in the cpp side
This cannot be true because if you comment out this line then you will have to comment it in wrapper's constructor and destructor. If you do that than the class do nothing so it cannot corrupt memory.
-Saurabh
|
|
|
|
|
Saurabh.Garg wrote: Are you sure this code has a bug?
Unfortunatly, yes. I mean you're right, this code is valid(i have been using it for years in another project). But when i have ported it into an new project and after splitting the two classes the corruption takes place. Did you use two *.h and *.cpp file, or did't you implement them in a single file.
Saurabh.Garg wrote: This cannot be true because if you comment out this line then you will have to comment it in wrapper's constructor and destructor. If you do that than the class do nothing so it cannot corrupt memory.
Correct, i commented the usage of the function pointer in the constructor and destructor. Maybe I shouldn't have showed them in this example.
Learn from the mistakes of others, you may not live long enough to make them all yourself.
|
|
|
|
|
Well I tried with separate files, just like you mentioned, and I tried within a single file and this code runs perfectly fine.
Btw I am using VS 2008.
-Saurabh
|
|
|
|
|
Saurabh.Garg wrote: Btw I am using VS 2008.
I'm still using VS 2005.
But I have found a way to get it working.
When i replace the forward class declaration with in including of the class,
everything works fine??
#pragma once
class functional;
#include "functional.h"
class wrapper
{
public:
wrapper(functional* pFun);
~wrapper(void);
void (functional::*pExitFunction)();
functional* _pFun;
};
Maybe its a bug in the VS 2005 compiler, I'm really not getting this.
Either way its working now,
thanks for the response anyway.
Learn from the mistakes of others, you may not live long enough to make them all yourself.
|
|
|
|
|
Hmmm thats interesting, it seems too simple to be a bug. Anyway its good you got it working.
-Saurabh
|
|
|
|
|
void Separate::WordSeparate1(ArrayList* start,ArrayList* end)
{
ArrayList** wordStart=new ArrayList*();
ArrayList** wordEnd=new ArrayList*();
IEnumerator *wordStartEnumerator,*wordEndEnumerator;
ArrayList** wordStart1=new ArrayList*();
ArrayList** wordEnd1=new ArrayList*();
}
the concept of double pointer is only available in vs2003....now i need to work this function in vs2005. how can i use the concept of double pointer in VS2005???
regards,
amit
|
|
|
|
|
Double pointers are still available, but this "new ArrayList*();" wont work. Use some kind of PointerList.
Greetings from Germany
|
|
|
|
|
|
Hi,
I'm having a problem creating a CDialog in a dll. The dll adds a menu entry to explorer context menus and executes some action when user clicks on menu entry. It should display a dialog (derived from CDialog). The dll had enable-MFC checkbox checked in the new-project wizard. But there's a problem with the resource handles. When the dialog is created it gives an assert in this code in AFXWIN1.INL:
_AFXWIN_INLINE HINSTANCE AFXAPI AfxGetResourceHandle()
----> { ASSERT(afxCurrentResourceHandle != NULL);
return afxCurrentResourceHandle; }
|
|
|
|
|
put the following code before you create the dialog.
AFX_MANAGE_STATE( AfxGetStaticModuleState());
|
|
|
|
|
Many thanks, it worked!
|
|
|
|
|
Please refer here[^] for more information.
Regards,
Paresh.
|
|
|
|
|
I have created and project in MS visual studio 6.0 as below
#include "stdafx.h"
#include <iostream.h>
class Rational
{
double r;
public:
Rational(int numerator, int denominator)
{
r = numerator/denominator;
}
operator double()const
{
cout<<r<<endl;
}
};
int main(int argc, char* argv[])
{
Rational r(1,2);
cout<<r;
cout<<endl;
return 0;
}
It works fine.
But when I build the same in MS visual studio 2005, the following error comes
1>c:\problemimplicittypeconversion\implicittypeconversion.cpp(5) : fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory
How to rectify this problem
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
Change to
#include <iostream>
using namespace std; // and add this line if you don't want to write std::cout everytime
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
|
Is vc 2005 express edition?
--
"Programming is an art that fights back!"
|
|
|
|
|
vibindia wrote: How to rectify this problem
Have you checked if the file exists or not?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|