|
You don't need to use reinterpret_cast in this case and in fact shouldn’t: casting from double to int is implicit so the following will do the trick:
double d = 3.5;
int i = d;
Is you wanted to make the cast explicit (and there is good reason to do so as it will suppress a warning) static_cast is the right cast for the job. i.e.
double d = 3.5;
int i = static_cast<int>(d);
Part of the point of adding the function style casts was to make your intent specific thus it is important to use the right cast for the job.
Steve
|
|
|
|
|
|
Math.round
public static int round( float a )
Returns the value of the argument rounded to the nearest int value.
--------------------------
just do it like that :
#include <math.h>
:
double MyDouble = 2345.5678 // MyDouble is a Double.
int MyInt = ROUND(MyDouble) // MyInt contains 2346.
:
double MyDouble = 2345.4678 // MyDouble is a Double.
int MyInt = ROUND(MyDouble) // MyInt contains 2345.
|
|
|
|
|
csc wrote: public static int round( float a )
Is this in C++ ? I mean that public modifier.
csc wrote: int round( float a )
csc wrote: ROUND(MyDouble)
Case sensitive?!
No '; ' , it doesn't compile.
Maxwell Chen
|
|
|
|
|
yes maybe in next time,isnt possible!?
|
|
|
|
|
Basic maths will do the trick. Try this:
double d = 2345.5678;
int i = d + 0.5
Steve
|
|
|
|
|
hi
Do we have any function to know the operating name on which one is currently working on?
|
|
|
|
|
GetVersionEx(...)
Sample[^]. This doesn't use the above function but you will enjoy this.
Nibu thomas
Software Developer
Faqs by Michael dunn
|
|
|
|
|
|
I'm sorry I meant to say if there is a method that test if a File exist or not?
thanks!
alantop
|
|
|
|
|
one way
WIN32_FIND_DATA m_data;
HANDLE hFile;
hFile=FindFirstFile(filename,&m_data)
if(hFile==INVALID_HANDLE_VALUE)
|
|
|
|
|
Make sure you close the handle if the file is found.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
sure and thank you
use
FindClose(hFile);
|
|
|
|
|
You can use SHGetFileInfo()
The prototype of the function is as follows:
DWORD_PTR SHGetFileInfo( <br />
LPCTSTR pszPath,<br />
DWORD dwFileAttributes,<br />
SHFILEINFO *psfi,<br />
UINT cbFileInfo,<br />
UINT uFlags<br />
);
_AnShUmAn_
|
|
|
|
|
|
Hi,
When I use "PathFileExists()" in my MFC code, it is giving me Linking error as follows,
Linking...
aDlg.obj : error LNK2001: unresolved external symbol __imp__PathFileExistsA@4
Debug/a.exe : fatal error LNK1120: 1 unresolved externals
Is ther any Library/ Header File for it?
Best Regards,
Aniket
|
|
|
|
|
#include shlwapi.h
and to your project
import shlwapi.lib
|
|
|
|
|
Hi,
Thanks for your solution. Now PathFileExists" is working.
Aniket
|
|
|
|
|
_access(..., 0) is one way.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
I can program to read a text document file (*.txt) , but cannot program to read a document file (*.doc) or rich text document (*.rtf) or adobe reader file (*.pdf) .
How to do it by using VC6 and C# ?
Please help me . Thank you a lot
imagic
|
|
|
|
|
|
You have to use automation for that (at least for doc and rtf files). Search on google.
|
|
|
|
|
thank you all for your replies. i am looking for a way to find x,y coordinates for a scanned image with a resolution of .001". For example, if i have a bitmap that is 10" X 10", and there is an image on my bitmap located at (x,y), how do I get the values for those coordinates?
thanks for any advice
|
|
|
|
|
a dialog based application :
BOOL CxxxDlgApp::InitInstance()
{
..............
CTnlDlgDlg dlg;
m_pMainWnd = &dlg; ???(why here the handle of dlg is 0x000000 ,if i want to use it here how to do ?)
int nResponse = dlg.DoModal();
..............
}
|
|
|
|
|
The windows hasn't been created at this time. This is done in the call to DoModal .
Steve
|
|
|
|