|
Now, where's that :whistle innocently: smiley...
Iain.
Iain Clarke appears even though CPallini no longer trusts him.
|
|
|
|
|
Iain Clarke wrote: Iain Clarke appears even though CPallini no longer trusts him.
But loves his sentences.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Iain Clarke wrote: I don't understand what you're talking about. You'll have to check your eyesight then look at my post again.
thats why i quoted the comment dude! nice move
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
ThatsAlok wrote:
thats why i quoted the comment dude! nice move
I would have got away with it too, if it wasn't for you pesky detail oriented developers!
Iain.
Iain Clarke appears because CPallini still cares.
|
|
|
|
|
Iain Clarke wrote: I would have got away with it too, if it wasn't for you pesky detail oriented developers!
thats why there is group called quality control in organization
|
|
|
|
|
Chandrasekharanp wrote: which is the best way to read a line from a text file in c..
That would all depend on how the file was opened.
Chandrasekharanp wrote: the size is not known.
Unless the file is still being written to, how can you not know its size?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
What is the difference between
#include "math.h" and
#include <cmath> </cmath>
and which is better?
Thanks & Regards,
Suman
modified on Friday, March 28, 2008 4:40 AM
|
|
|
|
|
first remove HTML support from your question!
#include<math.h> search for file in path configured in project setting/development env setting
#include "math.h" also search current directory including project/ developement env setting
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
ThatsAlok wrote: #include "math.h" also search current directory including project/ developement env setting
Maybe a minor difference, using the quotes the searches first in the current directory and then in the project/ developement env setting.
This means that you can overrule include files
codito ergo sum
|
|
|
|
|
BadKarma wrote: Maybe a minor difference, using the quotes the searches first in the current directory and then in the project/ developement env setting.
Right you say!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
Hi,
Thanks for help.
I actually meant "cmath", but it was deleted bacause of the tags.
Thanks,
Suman
|
|
|
|
|
ohh! CMATH header file is c99 compliant header file, see you don't use .h while including that file!, actually all the function under cmath header files comes under STD namespace!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
Hi,
#include "....." is to include the files which are in your current working directory. For eg. if you have created some file which needs to be included in another cpp / c file for using a function or any member the you can use this option.
if u have created a file a.cpp having some generalize function and you want to use this function in every other .cpp program then you can include this source code file in other source code using
#include "a.cpp"
#include <.....> is generally for dev/project Include folders which contains built-in .h files or any other files.
Regards
SG (sgg245@yahoo.co.in)
|
|
|
|
|
Hello everyone,
All swap functions in STL container class is exception safe and nothrow, right? I have searched for swap for vector and deque, but seems no explicit document about the exception safe level.
thanks in advance,
George
|
|
|
|
|
My friend here suggested creating a separate message board to handle your queries!
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
We should treat people equal, no special privilege for me.
regards,
George
|
|
|
|
|
Hello everyone,
What does the following statement about derived class mean?
http://www.gotw.ca/gotw/059.htm
--------------------
Unreasonable Statement #1: "Polymorphism doesn't work in C++ because you can't make an arbitrary class usable in place of a Base& without changing it (to derive from Base)."
--------------------
thanks in advance,
George
|
|
|
|
|
It's an unreasonable statement. What more explanations do you need?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
I do not know what is the "wrong" unreasonable statement. How do you understand it?
regards,
George
|
|
|
|
|
The whole statement is unreasonable, because it pretends to invalidate the C++ polymorphism because of, general classes cannot exploit polymorphism from a given one without modifications (i.e. deriving from).
But I have to admit, it is not crystalline concept (it simply express author's point of view...)
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Thanks CPallini,
Do you mean modify the derived class to declare it to inherit from some specific base class? In this senses, we can say it "modifies" something, or in other words, if we can not modify like this, we can not use polymorphism?
regards,
George
|
|
|
|
|
Hi Everyone,
I write one ActiveX controls.but i dont know how to make that activex control in a single file.Like VB we have Option Make an Ocx file in file menu. so in VC++ also do we have any option to make an activeXcontrol like that. Please REPLY ME SOON.
THANKS IN ADVANCE,
savitri.
|
|
|
|
|
savitri wrote: I write one ActiveX controls.but i dont know how to make that activex control in a single file.Like VB we have Option Make an Ocx file in file menu. so in VC++ also do we have any option to make an activeXcontrol like that
Did you choose the project option for creating an ActiveX control. If yes, than when you compile your code a .ocx file would be generated as output.
savitri wrote: Please REPLY ME SOON.
I hope this solution helps you and was posted SOON.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
savitri wrote: Please REPLY ME SOON.
Please hold your breath until I get back to you.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Hello,
Using below code i am trying to authorize user "Valid\User1" to create COM object of "TestServiceSecurity" from a remote machine.
This code is working fine that is it not throwing any kind of error but still it is not giving autorization to "User1".
Can anybody help me with this?
Thanks in advance.
*************************************************************************************************************************
BOOL bDaclPresent = FALSE;
BOOL bDaclDefaulted = FALSE;
DWORD dwError = 0;
DWORD dwSize = 0;
EXPLICIT_ACCESS ea;
PACL pacl = NULL;
PACL pNewAcl = NULL;
PSECURITY_DESCRIPTOR psd;
SC_HANDLE schManager = NULL;
SC_HANDLE schService = NULL;
SECURITY_DESCRIPTOR sd = {0};
SERVICE_STATUS_PROCESS ssp;
DWORD dwBytesNeeded;
PSID sid;
schManager = OpenSCManager(0, 0, SC_MANAGER_CONNECT);
if (schManager == NULL)
DisplayError(GetLastError(), TEXT("OpenSCManager"));
schService = OpenService(schManager , "TestServiceSecurity",SC_MANAGER_ALL_ACCESS);
if (schService == NULL)
DisplayError(GetLastError(), TEXT("OpenService"));
psd = (PSECURITY_DESCRIPTOR)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, dwSize);
// Get the current security descriptor.
BOOL bResult = QueryServiceObjectSecurity(schService, DACL_SECURITY_INFORMATION, psd, 0, &dwSize);
if (!bResult)
{
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER){
psd = (PSECURITY_DESCRIPTOR)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, dwSize);
if (psd == NULL){
DisplayError(0, TEXT("HeapAlloc"));
// note HeapAlloc does not support GetLastError()
}
bResult = QueryServiceObjectSecurity(schService, DACL_SECURITY_INFORMATION, psd, dwSize, &dwSize);
if(!bResult)
DisplayError(GetLastError(), TEXT("QueryServiceObjectSecurity"));
}
else
DisplayError(GetLastError(), TEXT("QueryServiceObjectSecurity"));
}
// Get the DACL.
bResult = GetSecurityDescriptorDacl(psd, &bDaclPresent, &pacl, &bDaclDefaulted);
if (!bResult)
DisplayError(GetLastError(), TEXT("GetSecurityDescriptorDacl"));
// Build the ACE.
BuildExplicitAccessWithName(&ea, TEXT("Valid\\User1"), COM_RIGHTS_EXECUTE,
SET_ACCESS, NO_INHERITANCE);
dwError = SetEntriesInAcl(1, &ea, pacl, &pNewAcl);
if (dwError != ERROR_SUCCESS)
DisplayError(dwError, TEXT("SetEntriesInAcl"));
//AddAccessAllowedACEToACL(
bool bIsValidACL = IsValidAcl(pacl);
// Initialize a NEW Security Descriptor.
bResult = InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION);
if (!bResult)
DisplayError(GetLastError(), TEXT("InitializeSecurityDescriptor"));
// Set the new DACL in the Security Descriptor.
bResult = SetSecurityDescriptorDacl(&sd, TRUE, /*pNewAcl*/NULL, FALSE);
if (!bResult)
DisplayError(GetLastError(), TEXT("SetSecurityDescriptorDacl"));
// Set the new DACL for the service object.
bResult = SetServiceObjectSecurity(schService, DACL_SECURITY_INFORMATION, &sd);
if (!bResult)
DisplayError(GetLastError(), TEXT("SetServiceObjectSecurity"));
// Close the handles.
bResult = CloseServiceHandle(schManager);
if (!bResult)
DisplayError(GetLastError(), TEXT("CloseServiceHandle"));
bResult = CloseServiceHandle(schService);
if (!bResult)
DisplayError(GetLastError(), TEXT("CloseServiceHandle"));
// Free buffers.
LocalFree((HLOCAL)pNewAcl);
HeapFree(GetProcessHeap(), 0, (LPVOID)psd);
void DisplayError(DWORD dwError, LPTSTR pszAPI)
{
LPVOID lpvMessageBuffer;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM,
NULL, dwError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&lpvMessageBuffer, 0, NULL);
//Now display this string.
_tprintf(TEXT("ERROR: API = %s.\n"), pszAPI);
_tprintf(TEXT(" error code = %u.\n"), dwError);
_tprintf(TEXT(" message = %s.\n"),
(LPTSTR)lpvMessageBuffer);
// Free the buffer allocated by the system.
LocalFree(lpvMessageBuffer);
ExitProcess(dwError);
}
*************************************************************************************************************************
|
|
|
|
|