|
Nope. The options are 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, well you know how to go on.
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
|
|
|
|
|
CPallini wrote: Nope. The options are 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, well you know how to go on.
lol -- I wonder if there is any correlation between age/language/education and the habit of declaring arrays sized by powers of 2. I always have.
|
|
|
|
|
I think the correlation is with age. But it is sporadic, for instance it happened to me first when I was 16, then on my 32. Well you know how to go on.
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
|
|
|
|
|
|
see _scprintf[^] which returns the number of characters in the formatted string. you can use the count to dynamically allocate the buffer that is to be passed to sprintf.
if you have only static hardcoded format string such as "%d plus %d is %d" you can manually calculate the formatted string length as %d formats an integer and you know the maximum and minimum value of integer.
|
|
|
|
|
Hi all,
I've to develop and application that must satisfy some
"real time like" requirements.
The application has to do something periodically; the period
is about 10 milliseconds and it must be very accurate:
it cannot be affected by operations done in the user interface
like mouse moving or window resizing.
What's the best timer to solve this requirement ?
Is it multimedia timer ? or there are better timers ?
Thanks a lot
|
|
|
|
|
On a standard windows platform ? If yes, forget about it because windows is not a real-time operating system. You can have jitter varying up to 10 msec and there's no way to control that. You'll have to use another operating system for that (WinCE for example, which has a different scheduler).
|
|
|
|
|
ilgale wrote: What's the best timer to solve this requirement ?
Hardware timer on an embedded device...
Seriously, if your requirement for determinism is at all strict [*], a general purpose OS like windows is not for you.
The nearest I'd say is some sort of device driver (you don't actually need a device to write one) using waitable timers. But even then, you'll get jitter.
Iain.
[*] You said "very accurate". Being an engineer, I'm assuming you're not exagerating.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|
|
Hi,
i want to get number of printers attached to my computer, i use Win32_printer class to get the printers, but before connecting WMI i impersonating to some other user. But the WMI gives the output not for the impersonated user but the one who has launched it.
I am launching the process in system accout and trying to impersonate to the logged in user to get the printer information of the logged in user. (Initially i have to launch the process in system account) Does anybody has any idea how to do this??
|
|
|
|
|
Check why the Impersonate to other user is not successful.
|
|
|
|
|
Hello friends,
I've a MFC Extension DLL in which it declares the shared variable as below
in .cpp file I have code as below
#pragma data_seg(".adshared")
int count=100;
#pragma data_seg()
#pragma comment(linker, "/SECTION:.adshared,RWS")
I've the method to get the value of count variable
bool Getvar2(int *p)
{
*p=count;
return true;
}
in .DEF file I have the code as below
Getvar2 @1
count @2
In the client application I've tried the code as below
1)
int *i;
i = (int*) GetProcAddress(m_hDLL, "count");
2)
//FunPtr2 is typedef bool(*FunPtr2)(int *p1);
p=(FunPtr2)GetProcAddress(m_hDLL,"Getvar2");
if(p(v))
{
}
In both the above cases the program crahsed when I try to access shared variable of the MFC Extension DLL.
How can we access the shared variable from the client application?
ritz1234
|
|
|
|
|
ritz1234 wrote: p=(FunPtr2)GetProcAddress(m_hDLL,"Getvar2");
Have you checked p value?
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 for the reply,
yes,I've checked the value of p and it contains the valid value.
The access violation occures at the next line after p has been intialized.
ritz1234
|
|
|
|
|
How v is declared?
Why don't you use accessor methods (i.e. int getCount() , void setCount(int x) )?
Have you made a test with a not-shared variable?
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,
It works for me.
See you tomorrow.
ritz1234
|
|
|
|
|
i have a simple game i need creating to help later on with my course, can any one please help ASAP! thank you
|
|
|
|
|
dinozulf wrote: i have a simple game i need creating to help later on with my course, can any one please help ASAP!
Yes, someone can.
dinozulf wrote: thank you
You're welcome.
BTW have you read forum guidelines?
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
|
|
|
|
|
You will have to ask a question for someone to help you.
-Saurabh
|
|
|
|
|
How about creating a game called "LIFE" that we all are playing. It should be simple enough.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
We need to play a different game. ![Wink | ;)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_wink.gif)
|
|
|
|
|
like AOM
"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
|
|
|
|
|
Hello to all,
In my project I am uploading some data on to the ftp server and for this I am using classes CFtpConnection and CInternetSession, means through function "GetFtpConnection" of class CInternetSession I am getting pointer of class CFtpConnection and then using that pointer I am using function "PutFile" of class CFtpConnection which actually uploads data of my computer to the server folder mentioned.But now the problem is that, uploading is getting failed and if traced the error through "GetLastError" I am getting error code "12031" which indicates "Manifest Parse Error:Incorrect syntax was used in a comment"(as per MSDN help) but I am not getting actual meaning of this error,can anyone tell me exact meaning of this error? why my data is not getting uploaded on to the server? actually internet speed is also good but still uploading is getting failed,can anybody help me please? its very urgent,please help me.
Thanks and Regards,
Anay
|
|
|
|
|
AnayKulkarni wrote: ...if traced the error through "GetLastError" I am getting error code "12031" which indicates "Manifest Parse Error:Incorrect syntax was used in a comment"(
Are you sure that's not 14031?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
No I have checked it many times,it is 12031,please can you help me?
Anay
|
|
|
|
|
AnayKulkarni wrote: No I have checked it many times,it is 12031,
Where? I just checked here and this it what it has:
#define ERROR_SXS_XML_E_COMMENTSYNTAX 14031L
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|