|
|
It could be anything... Something went wrong in your program (in general, most of the time it is because you are writing at non valid address). It is impossible for us to tell exactly what the problem is with so little information.
What you can do, to find out where the problem is, is to use the debugger: press F5 to start it and F9 to set and remove breakpoints. It will allow you to step into your code and see where is the problem (and then to find a solution).
|
|
|
|
|
basically, i've 1 menu program (treeview browser). while user clicking their desired program, this menu program will execute selected program using CreateProcess(...) function.
Then, somehow when CreateProcess() start to initiate program exe, window will prompt me with this error msg...and the selected program will b terminated (by window... i guess).i would say the failure might triggered by this menu program or the selected program.
problem was, when i debug or run it (both of program) from vc++ build menu, the said error msg will not happen. waaaaaaa i dont know where and when the problem was....
|
|
|
|
|
NasHata79 wrote: Then, somehow when CreateProcess() start to initiate program exe, window will prompt me with this error msg...and the selected program will b terminated (by window... i guess).
So, this is not in your main program that the bug appears ? You launch another program and this is this new program that crashes ? What happen if you launch this program by simply double-clicking on it ? If the bug is still there, then you'll have to debug this program instead. If the bug disapear, then it's probably due to the fact that the way you call the program is wrong.
|
|
|
|
|
thanx, will get my colleague to try this out! It is fine to me if d problem was d menu program itself (it is a small prog instead)... if not, my tears will keep on dripping...d other prog was a big one!!! somemore, original owner has resigned
|
|
|
|
|
NasHata79 wrote: original owner has resigned
Sounds like a good move!
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|
Could this simply be a case of "works in debug, doesn't work in release"? You might have some bug that is being covered up by the Debug version of your project that becomes apparent in the release version.
Do a search on Google on "works in debug, crashes in release" or something like that. Basically you want to reconfigure your release project in VC so that it includes debugging information, uses the program database for edit, and you probably want to start by turning off all of the compiler optimizations. So, you start with a release version that does not use things like the debug_new memory allocator, which might be masking your problems. For example, debug_new automatically initializes all uninitialized variables to some value, release (regular new) does not.
There are a lot of good articles/posts out there on "surviving the release version" (you might also search on that phrase in Google. Joseph Newcomer has a good article on his website with that exact title I think.
Good luck.
|
|
|
|
|
I have a base class name as "Base " and i have a function name as Fun1()
in it ,
now i derive a class from the Base calss called as Derived and i have
the same function Fun1()
I want to call the funcition Fun1() of the base class with a pointer of
the derived class .How? Also if fun1() is defined Virtual ?
Vikas Amin
Embin Technology
Bombay
|
|
|
|
|
|
hey by using pointer.
Vikas Amin
Embin Technology
Bombay
|
|
|
|
|
|
pDerived->Base::Fun1()
Steve
|
|
|
|
|
hey this dont work it gives an error
class Base
{
public:
virtual fun1()
{
cout<<"Base::fun1 \n";
}
};
class Derived: Base
{
public:
virtual fun1()
{
cout<<"Derived::fun1\n";
}
};
void main()
{
Derived *der_ptr=new Derived;
Base *bas_ptr=new Base;
der_ptr->fun1();
der_ptr->Base::fun1() ;
}
Vikas Amin
Embin Technology
Bombay
|
|
|
|
|
You're missing the public keyword. Make your derived class look like this:
class Derived: public Base
This specifies public inheritence which is the "normal" choice.
Steve
|
|
|
|
|
Oh yeh
thank you
Vikas Amin
Embin Technology
Bombay
|
|
|
|
|
Also, to complete the other answers, the rule with the virtual keyword is as follow: if the function is not virtual, it will call the function from which the pointer is related to. Take this example:
void main()<br />
{<br />
Base *bas_ptr=new Derived;<br />
<br />
der_ptr->fun1();<br />
} <br />
In this case, if fun1 was not declared as virtual, the function called would be the one from the base class, because your pointer is of the type Base, even if it has been created as a Derived class. Now, take the same example but instead declare fun1 as virtual, then in that case the function that will be called would be the one from the child class.
Hope it makes thing more clear
|
|
|
|
|
Yeh i got the point
The function that is called depends on object if Virtual
but it depends on the pointer if its Non-virtual
A derived pointer cannot point to a Base class object
with type-casting we can assing a derived class pointer to a base class object
say by static_casting , is it a good practise ?
Vikas Amin
Embin Technology
Bombay
|
|
|
|
|
vikas amin wrote: The function that is called depends on object if Virtual
but it depends on the pointer if its Non-virtual
More or less. In fact, with a virtual function, you will have what is called a virtual function table, that is a table that will replace the pointers of the virtual functions of the base class by those of the derived class.
vikas amin wrote: A derived pointer cannot point to a Base class object
I don't really understand your point here. You can always look at a pointer to a derived class as a pointer to the bass class. That's how polymorphism works: you have a bunch of pointers to one base class but each of them is instancied as a specific derived class (derived1, derived2, ...) and they are all treated as if it was a bas class.
vikas amin wrote: with type-casting we can assing a derived class pointer to a base class object
say by static_casting , is it a good practise ?
Yes, you can always cast a derived class into its base class (again, that's used with polymorphism). But in general, you don't need to cast it. In general, when you use virtual functions it is for overriding some of the properties of your base class and replace them with properties of your child class.
|
|
|
|
|
wrote code for downloading a file, what do i do to pause in between using a button on the dialog box? Somebody please help...
|
|
|
|
|
|
Can anyone help me program an OS?
--------------------------
Eric
I still need to learn C++!
--------------------------
|
|
|
|
|
wow, that is a very tough question you have there.
waxie
|
|
|
|
|
First:
Read about PC boot procedures and events. You could also look at a free OS (Linux? FreeDOS?) in order to learn how they implemented that. Or you could resort to a "boot-manager" ala LILO or GRUB and try to build on that.
You also need to read about processor modes (real mode, protected mode, how to switch between them, etc.).
When you have a basic OS up (probably mostly ASM-code) you can think about porting a compiler (GCC?), probably in an older version, to work on your OS. Remember that almost all "new" compilers are compiled by an "old" compiler.
If you are that far, think about porting "standard tools" like directory browsing (have you decided on a partition format yet or are you gonna create your own?) and a driver framework.
Building a VERY BASIC OS may not be too difficult. I remember seeing a book about that once, which claimed that you could write your own "basic" OS within a few weeks of work.
I hope this helps
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
That's like asking "How do I write a 3D game?" such a broad question that if you ask it you aren't ready to write one.
8bc7c0ec02c0e404c0cc0680f7018827ebee
|
|
|
|
|
Hi,
Could you provide me a code snippet on how to acquire the IP address of the computer? I'm not using .NET just a pure visual c++ IDE. I just want to get the ip address of my computer and store it in a string.
If you could give me an idea on how to do that without using the .NET environment, I'd really appreciate it very much.
Thanks,
Christina J.
|
|
|
|