|
Anonymous wrote:
I have a function that accepts an input from the console and I need to check that the type of the value received is 'int' before attempting some computation on it.
1) Does anybody know how to do that ?
If the function accepts an int as a type, there's nothing else it could be.
Anonymous wrote:
2) I desperately tried to find the answer in Visual Studio documentation but have drowned in the sea of documentation offered... is there any clear language reference supplied with the tool, organised in such a way you can actually find something in it ?
Depending on what you are seeking, Google and MSDN are useful resources.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
|
Always accept input from the console as a string: fgets is the old standby,
or cin.getline() to use c++ style
Then there are a couple of possibilities for extracting data from the string
and checking its type. You might look at the sscanf function.
|
|
|
|
|
Anonymous wrote:
I have a function that accepts an input from the console and I need to check that the type of the value received is 'int' before attempting some computation on it.
1) Does anybody know how to do that ?
That depends on how you are reading it. If you use
int x;
std::cin >> x;
then a simple way to test for failure is with
if(std::cin)
after the read operation. This will return true if all went well and false if it didn't.
Because there are different failure conditions, there are different flags that can be set following failure and there are different functions for checking on them. If you want this level of detail, then it isn't simple because the same flag can be set in response to more than one type of failure and because there is not a one to one mapping between flags and the functions for retrieving them.
If there is a read failure, then you need to reset the input stream (using cin.clear()) so that reading can continue. You also need to tell cin to ignore the erroneous input with cin.ignore(...). I suggest you consult a good C++ book that covers IO Streams.
Anonymous wrote:
I desperately tried to find the answer in Visual Studio documentation but have drowned in the sea of documentation offered... is there any clear language reference supplied with the tool, organised in such a way you can actually find something in it ?
Unless you already know what you are looking for, you are unlikely to find it. Get yourself several good C++ books plus The C++ Standard Library by Nicolai Josuttis.
John Carson
"I wish to propose for the reader's favourable consideration a doctrine which may, I fear, appear wildly paradoxical and subversive. The doctrine in question is this: that it is undesirable to believe a proposition when there is no ground whatever for supposing it true."
- Bertrand Russell
|
|
|
|
|
I need help Using HTMLHelp topic templates. I am trying to find out how to use topic templates on a HTMLHelp project so the style will be consistant. Can you point me to some direction? I have researched from the HTMLHelp help file and the web. I found information on sample codes of templates, but I do not see any example on how to use the templates.
Elizabeth
|
|
|
|
|
Hi ,
I"m working on an image processing application and I need a way to convert/return a BITMAP handle to IPicture, so that I can show the return IPicture in VB.PictureBox control.
Nathani
|
|
|
|
|
Hi Nathani,
In VC++ use CoCreateInstance() to create the IPicure COM object. Then select the bitmap and everything and then pass the handle to VB using IPicture::get_Handle(). Do not worry about process boundaries, since it is the same process.
Ivor S. Sargoytchev
Dundas Software
|
|
|
|
|
i have a flexgrid and i want to enter time into one cell with a date time control
i have managed to make it visible at the click of that particular cell and invisible at lost focus
now what i need is to position the datetime control during run time relative to the click event
for this i think i need the handle of the datetime control
so how can i get that and tell me if there is any other way out to get this done
the codes which i use now r as follows
on click event of the flex grid
******
if((m_fgAppRem.GetCol())==3) //if col 3 is clicked
{
GetDlgItem(dtpFlexGrid)->ShowWindow(true); //Date time control made visible
m_dtpFlexGrid.SetFocus(); //set focus to datetime control
}
where
m_fgAppRem is the member variable of flex grid(CString)
m_dtpFlexGrid is the membervariable of datetime control(CDaateTimeControl)
*******
i think i have to add the following line to position the control at run time
::SetWindowPos(m_dtpFlexGrid.m_hWnd,
wndNoTopMost,
ParentPosition.left + 555,
ParentPosition.top + 3810,
0, 0, // ignores size arguments
SWP_NOSIZE);
where m_dtpFlexGrid.m_hWnd is the handle of the date time control
but i am not getting the handle of the datetime control
ie (m_dtpFlexGrid.m_hWnd0) 's control
so please give me a solution
Salil cheeran
Bangalore
INDIA
|
|
|
|
|
I am new to DIBs but am presently studying them diligently. To this point, I have been playing my EMF images into memory, using CreateCompatibleBitmap() for my image bitmaps and CreateBitmap() for my masks. My question is, does this article: "A DIBSection wrapper for Win32 and WinCE" address what I will need to do in order to incorporate DIBSections into my scheme? (I use MFC.) Thanks for any reponse.
|
|
|
|
|
When I started with DIBs the MSDN article "DIBs and Their Use" was very helpful for me.
It is quite old, but gives basic knowledge about how to use DIBs.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dngdi/html/msdn_dibs2.asp
I know that there is a CDIB class which wrapps the DIB API. This class has been introduced in an atricle in one of the MS development magazines. Unfortunately it is not yet part of MFC. I think you should find it if you search in the MSDN library.
|
|
|
|
|
Thanks a lot for the helpful tips!
|
|
|
|
|
Hi..
i tried to use CFileFind class to copy files from other machine in the same my workgroup (no authentication required) by using the following code for ex:
CFielFind finder;
finder.FindFile("\\xx\yy");
put it does not work so i would like to know if the way i call the folder path is wrong or is their an other suggestions
|
|
|
|
|
You are remembering that a backslash needs to be escaped by a backslash, aren't you..
eg
finder.FindFile("\\\\xx\\yy\\*.*");
Steve S
|
|
|
|
|
|
rasha2003 wrote:
i tried to use CFileFind class to copy files...
Hopefully you are using CFileFind to find the file(s) you want to copy. Otherwise, Steve has most likely solved your problem.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
I want to create dynamic DataGrid using datagrid.h class.
Help me please how to do it with a fragment of example.
Thanks in advance,
bilas.
|
|
|
|
|
hi
i used ie head files to make dximagetransform. And i included related head files. but the compile errors appeared:
e:\internet explorer 6sp1 header and library files\include\dxatlpb.h(298) : error C2668: 'InlineIsEqualGUID' : ambiguous call to overloaded function
e:\internet explorer 6sp1 header and library files\include\dxatlpb.h(308) : error C2668: 'InlineIsEqualGUID' : ambiguous call to overloaded function
e:\internet explorer 6sp1 header and library files\include\dxatlpb.h(313) : error C2668: 'InlineIsEqualGUID' : ambiguous call to overloaded function
what's wrong?
thanks.
|
|
|
|
|
It simply means that the specified overloaded function call could not be resolved. How are you calling InlineIsEqualGUID() ?
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
I included internet Explorer head files without any my codes. when i compiled, the problem had been appeared.
|
|
|
|
|
Simply including a header file should not cause this sort of compiler error. If you remove the aforementioned header file(s) from the project, does the compiler error go away?
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
off course, unincluding the head file,dxatlpb.h, can remove the error.
i use the latest platform sdk and internet explorer head.
Can you help me?and in terms of the guid of msdn i compile the project.
http://msdn.microsoft.com/workshop/browser/filter/howto/implementingproceduralsurfaces.asp?frame=true
thanks
|
|
|
|
|
When #include <dxatlpb.h> is removed, what compiler errors are generated?
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
hi
if i remove the #include, no errors are appeared.
Can you try to text the project following the cuid
http://msdn.microsoft.com/workshop/browser/filter/howto/implementingproceduralsurfaces.asp?frame=true
|
|
|
|
|
jackalwisdom wrote:
if i remove the #include, no errors are appeared.
Ok, so if you do not need it, why include it?
jackalwisdom wrote:
Can you try to text the project following the cuid
I would, but not having the DirectX SDK installed makes it somewhat difficult!
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
According to the KB (PSS ID Number: 243298):
CAUSE
The problem occurs because the function InlineIsEqualGUID() is defined both in the ATL header file, AtlBase.h, and the Platform SDK header file, Guiddef.h, in different name spaces. The include paths for the build point first to the Platform SDK include directory, and then to the ATL include directory. In the ATL header, InlineIsEqualGUID() is defined in a name space called "ATL", while in the Platform SDK header it is defined in the global name space. Because AtlBase.h includes the statement
using namespace ATL;
the compiler is unable to distinguish which definition to use.
RESOLUTION
To work around this problem, prefix the call to the InlineIsEqualGUID() function with ::ATL::. This explicitly qualifies the ATL namespace from where the implementation of InlineIsEqualGUID is pulled in. For example:
::ATL::InlineIsEqualGUID()
Ian Darling
"The different versions of the UN*X brand operating system are numbered in a logical sequence: 5, 6, 7, 2, 2.9, 3, 4.0, III, 4.1, V, 4.2, V.2, and 4.3" - Alan Filipski
|
|
|
|