|
I'm a newbie, too, but this one seems straighforward enough...
Most timer functions report results in milliseconds, but this app wants a duration in seconds. It also wants the duration value to be a type double. After taking the difference of two clock_t values it divides by 1000 to convert the result to seconds, then the prefix (double) casts the clock_t result to a double type. Curiously, MSDN describes clock_t as a struct defined in TIME.H,
"clock_t structure Stores time values; used by clock. TIME.H"
but looking through TIME.H reveals,
#ifndef _CLOCK_T_DEFINED
typedef long clock_t;
#define _CLOCK_T_DEFINED
#endif /* _CLOCK_T_DEFINED */
I just love inconsistencies - they make learning this stuff so interesting.
Will Build Nuclear Missile For Food - No Target Too Small
|
|
|
|
|
It's called a cast, and in this case it converts the integral result of (finish-start) to a double . This is important because without the cast, the division would be integer division, which would lose any remainder portion.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Pinky, are you pondering what I'm pondering?
I think so Brain, but if we shaved our heads, we'd look like weasels!
|
|
|
|
|
Now there's an interesting tidbit - the cast takes precedence over the division, eh? I learn something every time I visit here.
Will Build Nuclear Missile For Food - No Target Too Small
|
|
|
|
|
me too, and also when mike talks.
This space is empty.
|
|
|
|
|
Excellent resource, our Michael is...
Will Build Nuclear Missile For Food - No Target Too Small
|
|
|
|
|
|
Yup yup... just found it in my Visual C++ 6 Core Language book. And it's not even in the fine print.
Will Build Nuclear Missile For Food - No Target Too Small
|
|
|
|
|
I get this linker error with
XXX error LNK2001: unresolved external symbol ___argc
XXX error LNK2001: unresolved external symbol ___argv
XXX error LNK2001: unresolved external symbol __mbctype
XXX error LNK2001: unresolved external symbol __mbctype
XXX error LNK2019: unresolved external symbol __mbctype referenced in function "protected: long __thiscall CEditView::OnFindReplaceCmd(unsigned int,long)" (?OnFindReplaceCmd@CEditView@@IAEJIJ@Z)
Do you guys know of any VC tools or command that could easily allows me to trace which portion of the codes are needing this function cause I am porting to VC 7 and the existing source codes are calling a lot of libraries which is in everywhere.
thanks in advance.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
I have just found the solution.
Just in case someone would be interested.
The solution is placing needed macro and header onto your header.
#define _AFXEXT //the magic define needed by MFC in order to enable afxext.h
#include <afxext.h>
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Could anybody answer this question? i'm not sure if i'm in the right place to post this... so if i'm not can someone kindly send me in the right direction please
Question:
**********
I am looking for some info on using a (small) program within a website,
the program takes some details and outputs a set of numbers, but i would like to encorperate this into a website through a form (that, in a way, mirrors the input parts of the program).
so when someone enters the info into the webpage form, it runs the info through the program and outputs the generated numbers back to the website.
Please help
Kind Regards,
GameBoy™ (aka - MobiTec) MobiTec.me.uk
**********************************
if ( noobie = "confused" )
{
print "Search Google© for answer";
} else {
print "Go buy a book and learn!";
}
|
|
|
|
|
sounds more like an asp question may be asp.net forum may help you.
GameBoy™ wrote:
if ( noobie = "confised" )
confised or confused?
This space is empty.
|
|
|
|
|
Well
if ( noobie = "confused" )
{
print "Search Google© for answer";
will always be true, and he will be searhing the google, else will never occur

|
|
|
|
|
How can I find out why my program is eating up 90%+ of the cpu on certian functions in a thread? The slowest functions do the following:
Parse out xml contents from an string (loop, CString::Mid) its like 7000 of these ... its not finding any corruption but its just really slow its in a thread and just is taking up a lot of the cpu.
Loops through all the items in a CArray structure (CStrings ctime, and one or two floats) and just does some stuff with teh float and scores of text.. but its takes like close to a minute
Are there any optimization techniques cause its taking like 3/4 minutes for the feature to complete its task and eats up a lot of resources on a 1.5ghz 128mb ram machine , not even wmp9 does that.
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
How many threads? Sounds more like there is an infinite loop.
Kuphryn
|
|
|
|
|
Operations on float are costly.
This space is empty.
|
|
|
|
|
Yea the problem is I need percision to the 5 or 6 descimal place... what operator should I use?
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
(Steven Hicks)n+1 wrote:
Yea the problem is I need percision to the 5 or 6 descimal place... what operator should I use?
humm, i dont think you can do anything about it, you can only optimise the operation.
like remove unnecceary float converstion.
other wize you can always put that in a worker thread and show the progress to the user.
This space is empty. ![Java | [Coffee]](https://www.codeproject.com/script/Forums/Images/coffee.gif)
|
|
|
|
|
Without seeing sample code, it is hard to say.
When used poorly, CString can be VERY expensive. Floating isn't expensive at all unless you are doing millions and millions of operations.
CArray can also cause some problems, but not with static contents.
BTW, are you doing timing tests with the release version?
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Yes this is the release version, taking 3 some times more (not including download time) minutes.
The CStrings are used because the url string is pretty unpredictible.. yea most are under 80 but you never know ugh (therefore need a dynamic string)
Their are about 7 float operations per item.
In my test set there are 200 articles it is going though, therefore again the CString is needed for title and description publisher etc
its doing somewhere close to 1400 or more float operations.
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
When you consider the number of floating point operations we do per frame in a video game, 1500 float operations are nothing.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
i want to insert a thingy where you click on the right side then it drop down with DRIVES and Directory tree. is it the drop down combo box with some code or diferent one?
|
|
|
|
|
that thingy is a combo box custom made i suppose by microsoft.
This space is empty.
|
|
|
|
|
|
Hi everyone,
I need some help
I'm trying to get the MAC addresses for physical NIC's on the local P.C using multiple methods, getadapterinfo and snmp.
I have one instance where a P.C has VPN software installed (not microsofts) and thier virtual adapter is returning in these programs with a adapter type = 6 (ethernet adapter). I need only physical addresses for use of licensing.
Is there any way to identifier what adapters are physical, and what adapters are virtual???
Also should all virtual adapters be classified as a PPP adapter???
any help would be appreciated
Thanks in advance
Gilc137
|
|
|
|
|
I am not really sure what you want,
but if you were to do it in Windows,
you can use WMI to query the Win32_NetworkAdapterConfiguration object to get the MAC address
or via the registry - SOFTWARE\\Microsoft\\Windows NT\\Current Version\\NetCards
Sonork 100.41263:Anthony_Yio
|
|
|
|