|
John R. Shaw wrote:
File objects are like every thing else in C++ (only more so!), you need to know 10x as much as you do inorder to do the same thing in C; or to put it anouther way, you are offten - shooting in the dark.
Man, I just find that comment bizarre. An instance of an object that exposes an interface is harder to understand than a set of functions that pass handles around ? Besides, all the source code is provided, nothing is hidden.
John R. Shaw wrote:
In my opinion, ifstream/ofstream sucks!
ROTFL. Well, you're entitled to your opinion.
John R. Shaw wrote:
I am a believer in the KISS principle and C++ is based on the the KIC (keep it coplicated) principle.
No, object orientation is based exactly on the idea of keeping it simple, something C finds difficult. The standard library could certainly be easier to learn, but if someone is going to use C++, it's well worth their time to learn it. Once you understand how it works, it is indeed simple, it's also powerful, and extensible to boot. It's certainly a lot nicer than ugly C file handling, at least in my not so humble opinion. It's a pet peeve that ignorant professors teach C with classes instead of C++, meaning that far too many people have no idea the standard library even exists.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
If you find the statement that you need to know 10x as much in C++ than you need to know in C, then we need to talk. (When you look at a C-program, you know what is going to happen. When you look at a C++-prgram, you assume what is going to happen.)
Example:
for( object i=0; i != end; i++ )
What is wrong with the above example? In C (except for the term object) nothing.
C++ is great, but it hides so much that it is rediculus. I, like most peaple, ignore the details (a good part of the time), but the details is what distinguashes those who know and those who don't.
Interesting (A PHD wrote this):
#defined GReAlloc(b,nSize) ((!b)? malloc(nSize):If you find the statement that you need to know 10x as much in C++ than you need to know in C, then we need to talk. (When you look at a C-program, you know what is going to happen. When you look at a C++-prgram, you assume what is going to happen.)
Example:<pre>for( object i=0; i != end; i++ )
What is wrong with the above example? In C (except for the term object) nothing.
C++ is great, but it hides so much that it is rediculus. I, like most peaple, ignore the details (a good part of the time), but the details is what distinguashes those who know and those who don't.
Interesting (A PHD wrote this):
#defined GReAlloc(b,nSize) ((!b)? malloc(nSize):realloc(b,nSize))
)If you're a C programer (Whoops! The above was written in C), that makes almost no since.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Some-thing has went-very wrong here! But I'll leave the above post alone (even though; the posting software, appears to have lost its mind.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
hello friends
plz help me in this problem. i m making an intrusion detection system using vc++, in this output of sniffer has to be written in text file. is there is any function for that.
thanx
|
|
|
|
|
Is this sniffer program a console application? If so, its output can be redirected to a file from the command prompt like:
sniffer.exe > output.txt
If you need something a little more advanced, check out this and this.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I tried FMOD function that calculates floating-point remainder of division of two double v1,v2, but with v1 = 17.2 and v2 = 0.1 returns value f = 0.1 instead of f = 0.0.
Someone know why FMOD returns f = 0.1 ?
Thank you.
|
|
|
|
|
The problem is floating-point precision.
The floating-point system is based on exponent 2, that causes problems when encoding exp-10-digits.
Don't try it, just do it!
|
|
|
|
|
I'm adding IPv6 functionality to an application that has been designed to monitor the hosts by sending periodical ICMP packets (pings).
According to MSDN and the checkv4 utility, the addrinfo structure should be used, which works well when calling Icmp6SendEcho2[^] , however the problems arise when calling the IcmpSendEcho2 [^], because the fifth argument, the DestinationAddress is IPAddr struct type.
So the real question is: Are there any fuctions that will convert an addrinfo structure to an IPAddr or is there another way of doing this? (Using a bunch of if/else statements to check for IPv4/6 is not an option)
|
|
|
|
|
Declare a new address type like this:
typedef struct _SOCKADDR_IPv4v6
{
union
{
sockaddr_in addrv4;
sockaddr_in6 addrv6;
};
} SOCKADDR_IPv4v6, *PSOCKADDR_IPv4v6;
SOCKADDR_IPv4v6 addr;
Icmp6SendEcho2( ..., &addr.addrv6, ... );
IcmpSendEcho2( ..., addr.addrv4.sin_addr, ... );
Don't try it, just do it!
|
|
|
|
|
hi,
i'm trying to add-in the openvc.dll but i get the follwoing error:
"Unable to register this add-in because its DllRegisterServer returns an error"
i'm running VS6.0 on WindowsXP (SP2). not sure of the VS's service pack.
any ideas anyone?
cheers.
|
|
|
|
|
Can register openvc.dll from a command prompt? If you can, it is a problem with VS. If you cannot, it is a problem with the DLL itself.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi
I will create a connection between two computer using WINSOCK.OCX, but i don't know how can i accept a connection request after listening a port.
In other words, when i become a connection request, i call accept method of IMSWinsockControl, but the connection will aborted immediatly from remote host and connection will be closed.
I will be thankful if everyone can help me.
Alireza
|
|
|
|
|
In C++ I would strongly recommend avoiding the Winsock control. It's designed for environments like Visual Basic that can't do multithreading and as such is a real pain to use for connection-oriented sockets.
Instead I'd recommend that you just use the Windows Sockets library directly.
A useful resource is the Winsock Programmer's FAQ[^].
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Where is this information stored ?
Is there an interface to access it ?
|
|
|
|
|
If you have a handle to the window, you can use GetWindowRect() .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
How is XP/2000 WDM driver code different from WIn98SE WDM/WIn95 OSR2.1 WDM?
Tell ME why
|
|
|
|
|
Win95 does not support WDM!
Win98 supports WDM, but there are slight differences between Win2k/XP and Win98.
Don't try it, just do it!
|
|
|
|
|
I am using Visual C++ .NET 2003 and made a MFC multiple document application with a form view (CFormView). On that view is placed an edit box to which I connected a CString variable (including all those "DDX_Text(pDX, IDC_EDIT_NAME, m_Name)" etc.). In addition my application has keyboard shortcuts, defined in "Accelerator" in the ressource editor.
The problem is that those shortcuts interfere when I want to enter a text into the edit box, e.x. my shortcut keys don't result in a letter in the edit box but do the shortcut stuff (opening a dialog, etc.).
Is it possible to somehow override/disable all the keyboard shortcuts when the focus is on the edit box? If that's possible I could catch ON_EN_SETFOCUS and ON_EN_KILLFOCUS in the form view and disable and later enable again the accelerators.
Or do I have to write my own control derived from CEdit? (hopefully not...) Will the accelerators still have priority over my own control then or viceversa? (if yes even an own control won't help...)
Thanks & Bye,
T.T.H.
P.S.: I searched Codeproject on this problem for over an hour by now...
|
|
|
|
|
Error :
The process cannot access the file because it is being used by another process.
|
|
|
|
|
Pretty self explanatory error really.
Do you have any handle open to this file?
Is this file a DLL or an executable and is running at the moment?
Is it open in another application? Excel for instance does not let you delete a file while it is open with it.
Hope this helps...
|
|
|
|
|
well,
This file is normal text file and even if that is locked by any other process I want to delete it .
|
|
|
|
|
vikrams wrote:
even if that is locked by any other process I want to delete it
That a bad idea, you know?
Beside being a security breach (one process taking away a resource of another), it would lead to any amount of unstability: Your program youd not be sure about the 'openness' of a file it just opened, and had to check before *every* access.
Even then, there would be cases where the file disappeared between checking and access.
No, file locking is OK as it is.
Find the offendig process and end it.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
Have a look on codeguru.com for a program named forcedel.exe, if I remember correctly it comes with source code.
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
Hi!
Sorry, but I can speak English only a bit.
I have a little problem. I would like to display an image (GDI+), display a text and I would like to save them.
Graphics graphics(lpDrawItemStruct->hDC);
graphics.DrawImage(pDoc->bitmap,...);
graphics.DrawString(...);
Up to this point OK.
And after that I would like to save them!
(in a Doc/OnSaveDocument):
bitmap->Save(...);
But only the image saved after that. How can I save both the image and the text?
How can I copy the text into the pDoc->bitmap?????????????
Please help me! Thanks!
|
|
|
|
|
There are some very good articles at codeproject on GDI+ programming; they should answer your question.
It sounds like you are drawing the text on a copy of the bitmap and not the original bitmap. If you draw the bitmap on a window and then draw text onto that image, then you are not drawing on the original bitmap (image). What you need to do, is draw the text on the original image or copy the temporary image to the origianal image.
I am not sure how this is done with GDI+, but it is easy to do in GDI.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|