|
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);
}
*************************************************************************************************************************
|
|
|
|
|
Hai all,
my application should share same registry entry for diffrent users of same privilage In Vista. Please let me know if you have any idea.
regards
vicky00000
|
|
|
|
|
store it under LOCALMACHINE in the registry and add a new usergroup that you put all the users you want to be able to read/write the registry keys it into that usergroup and then set the ACL for that registry entrie so that that group has full access to it.
|
|
|
|
|
hi,is there a tool which can monitor the specified IO data translation?
I need a tool which can monitor the data translation between one program and the CDROM,not only the action but also the data they exchange each other.
thanks
|
|
|
|
|
Hi, all
<br />
CString cstr = "abcd";<br />
<br />
LPTSTR p = cstr.GetBuffer();<br />
<br />
p[2] = 'r';<br />
<br />
<br />
I want to change 'c' to 'r' in cstr.
How to do?
|
|
|
|
|
hanlei0000000009 wrote: // cstr is abcd, but not is abrd
CString cstr = "abcd";<br />
cstr.SetAt( 2,'r');
hanlei0000000009 wrote: I want to change 'c' to 'r' in cstr.
But your purpose is to replace the c with r, you can use the Replace function..
CString cstr = "abcd";<br />
cstr.Replace( 'c','r');
modified on Thursday, March 27, 2008 11:37 PM
|
|
|
|
|
You rarely need to use GetBuffer(). The CString class has most functions you need, including SetAt()...
CString cstr = _T("abcd");
cstr.SetAt(2, _T('r'));
If you insist on using GetBuffer(), remember:
"If you use the pointer returned by GetBuffer to change the string contents, you must call ReleaseBuffer ..."
CString cstr = _T("abcd");
LPTSTR p = cstr.GetBuffer();
p[2] = _T('r');
cstr.ReleaseBuffer();
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
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
|
|
|
|
|