|
|
Hi
I've been programming for about 4 years in C++ for fun, and I never really cared about that question. But now I'd like to know: What is "C" exactly, and what's the difference to "C++"? Is there any border? If I use functions like strlen, strcpy, strcat , fopen, fread, fwrite and use char s instead of std::string , do I program in "C" or "C++"? And what, if my program uses the Windows API?
Could someone explain to me, or give me some links that cover this question in detail?
thanks in advance
modified 12-Sep-18 21:01pm.
|
|
|
|
|
That's a tough question to answer in a short amount of space.
Here goes:
The main difference between C and C++ is that C++ has support for classes whereas C only supports structs. Because of this, a vast number of libraries/extensions are not available for use in C. This includes STL and MFC amongst others.
strlen, strcpy, strcat, fread, fwrite and char were all available in C. Obviously, the standard namespace was not. There are some language differences too, depending on the compiler, you can only declare variables in C at the beginning of you function. You can probably search Google for a complete list of syntactic differences.
Most of the Windows API should work in C as far as I know.
Personally, I prefer C - mainly for its purity, although I have been known to be a bit strange.
|
|
|
|
|
|
Greg S. wrote:
What is "C" exactly, and what's the difference to "C++"?
In addition to the others, here are some useful links:
http://www.research.att.com/~bs/bs_faq.html
http://www.research.att.com/~bs/bs_faq2.html
Greg S. wrote:
If I use functions like strlen, strcpy, strcat, fopen, fread, fwrite and use chars instead of std::string, do I program in "C" or "C++"?
You've not provided enough info for a sufficient answer. A C program can only use C code, but a C++ program can use both C++ and C. Consider the following .CPP file:
#include < iostream >
#include < stdio.h >
void main( void )
{
printf("Hello World\n");
}
Is it C or C++? Some folks would call it a C++ program because of the file's extension. Others would say not since it uses no C++ constructs. What if printf("Hello World\n"); were changed to std::cout << "Hello World\n"; ? Does that make a difference?
In some instances, I think it can be a difficult question to answer.
|
|
|
|
|
Ok, seems like I'm programming with a mixture of C and C++, I use class es and sometimes std::vector , which don't exist in C, but I also use strlen, fwrite etc, C-functions.
Seems to be hard to tell whether a piece of code is pure C or already C++.
Thank you all, you helped me understanding this topic
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Ok, seems like I'm programming with a mixture of C and C++, I use classes and sometimes std::vector, which don't exist in C, but I also use strlen, fwrite etc, C-functions.
If you look at the implementation some of those functions you'll be amazed that some are written in assembler! So would that make you an assembler programmer?
What I think is: C++ is has OOP (Object Oriented Programming) support. If you would use it, you would be programming in C++. Then again, within those classes and member functions you use C code
So what you shouldn't do is see C and C++ as 2 different languases, but see C++ as an extension to C !
In the end it all comes to 0's and 1's
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
Hi,
I have a VB library file which has many functions/constants.
How can I use that in a VC++ program?
Should I make a VB dll file, and include all of the functions in it?
Ehsan Behboudi
|
|
|
|
|
You have to covert it to COM library.
|
|
|
|
|
how can I do that?
Ehsan Behboudi
|
|
|
|
|
ok i just checked,,
the library is written according to COM.
what should i do next?
Ehsan Behboudi
|
|
|
|
|
use
#import "myvbcode.dll"
during c++ compilation it would generate
myvbcode.tlh
myvbcode.tli
which are automatically included
then just select the functionality you need. If you need more help, publish generated .tli file here and example of how you would use it in VB.
|
|
|
|
|
P.S.
#import "libid:12341234-1234-1234-1234-123412341234"
where 12341234-1234-1234-1234-123412341234 is you LIBID, is preferable. This way you do not depend on the location of the COM dll during compilation.
|
|
|
|
|
where in the VC++ program should I add
#import "myvbcode.dll"
??
Ehsan Behboudi
|
|
|
|
|
Stdafx.h usually is a good place. In general, it should be treaded as any other include file - you put right before the code that uses it.
the actual
#import "myvbcode.dll"
is substituted at compile time for
#include "myvbcode.tlh"
#include "myvbcode.tli"
|
|
|
|
|
Hi all,
I need to get the IWebBrowser2 interface from the HWND for an IE control. Currently I am using Active Accessibility to get the IHTMLDocument2 interface from an HWND.
Normally you can get the IWebBrowser2 interface from IHTMLDocument2 by querying IHTMLDocument2 for the IServiceProvider interface, then calling QueryService to get the IWebBrowser2 interface. This does not appear to work going through active accessibility. I believe this problem may have something to do with the set of objects that are marshalled with active accessibility.
If anyone has been able to successfully go from an HWND for an IE control to the IWebBrowser2 interface, I would really appreciate your help and solution.
Thank you
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hi
I'm desperately searching for a program who can create setups.
All utils i've found until now who can do that, are with annoying company screens or with limitations (if you want to change this, get the professional edition .. arghhh) etc.
Anyone found a very good one? or made one on its own?
Let me know;
Greetings
Jens
|
|
|
|
|
Do you mean that you do not want to pay for Wise or InstallShield and you are looking for freeware?
There is free version of setup which comes with VS.Net , the problem is it does not have fancy UI and you really have to understand Installer SDK (available for free from Microsoft)
|
|
|
|
|
Do you mean that you do not want to pay for Wise or InstallShield and you are looking for freeware?
indeed, i have no desire to pay for a program who makes a setup.
Don't need a fancy user interface, just the regular setup.
|
|
|
|
|
|
it does not support win installer
|
|
|
|
|
I dont think any of the free ones do and I believe that is a very good thing!! I have an application problem with the update for MSDE that everytime I reboot the pc it wants to reinstall MSDE. The thing is that it is fully installed and works fine...
John
|
|
|
|
|
I use NSIS from Nullsoft, the creators of Winamp 2.x. Winamp uses NSIS, CDex uses it and many other programs. What I like about NSIS is, that it is open-source, free and has a small scripting language
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
edit - screwed up the link - edit
Little Setup Builder[^]
Completely free and works very well.... a least for me.
...
|
|
|
|
|
I would go with John M. Drescher suggestion (InnoSetup), which is very simple to use.
Also Windows has an installer and this is the website [^].
Also, check your Visual Studio CDs because it has InstallShield somewhere, and there is also a tutorial on how to use it here in CodeProject.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|