|
|
Thank you all. Your suggestion are really helpful .
|
|
|
|
|
Are there any standard functions, either in the c libary or in windows, that can be used to read a hexidecimal number from a string similar to atoi?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
sscanf(), if you have a formatted string. For example:
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
string str = "0x1F";
int hex = 0;
sscanf(str.c_str(), "%X", &hex);
cout << "Hex value: " << hex << endl;
return 0;
}
Jon Sagara
Working with a database is iterative, like sex, but painful instead of pleasurable.
-- Marc Clifton[^]
|
|
|
|
|
I saw this before, but for some reason it did not seem that it worked that way to me.
Thanks
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
strtol() or strtoul()
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
Thanks, this is exactly what I was looking for.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Ha! Used all words that began with the letter i in the title! Beat That!
How do I prevent just the following warning from showing:
warning C4244: 'argument' : conversion from 'unsigned __int64' to 'unsigned long', possible loss of data
Its generated from the following code: (this isn't prefect code [buffer overrun], but thats not the focus)
//CFile * pFile
ULONGLONG dwLength=pFile->GetLength();
pFile->Read(strFileCnt, dwLength); //this is where it gets mad and throughs the unneccessary warning
-Steven
CP Addict
By reading this message you are held fully responsible for any of the mispelln's or grammer, issues, found on, codeproject.com.
For those who were wondering, actual (Linux) Penguins were harmed in creating this message.
|
|
|
|
|
Change your ULONGULONG to a ULONG. Then if GetLength() returns an __int64, cast it to ULONG to get rid of the new warning, and you're done.
The warning is not unnecessary, you're passing in a variable twice the size of the one required, so it could well hold information which will be lost in the function call.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
I put them in a warnings.h file
#ifndef __WARNINGS_H__
#define __WARNINGS_H__
#pragma warning(disable:4786) // identifier was truncated to '255' characters in the browser information
#endif // __WARNINGS_H__
Todd Smith
|
|
|
|
|
Hi. This is a continuation of the ? before. I just can't seem to compile the program.
I had a program with CClass and CBaseClass classes DONE without Template and it works fine. Now I changed things to:
template<class x=""> CBaseClass
{
...
}
Outside the template the functions are in..
template<class x=""> void CBaseClass<x>::Function()
{
...
}
I know the base baseclass declaration is OK
AND
template<class x=""> CClass: public CBaseClass<x>
{
//I tried several syntax for the constructor and other fuunctions
CClass();
virtual ~CClass();
OR
CClass():CBaseClass<x>();
virtual ~CClass():CBaseClass<x>();
void Function():CClass<x>::Function()
//Both don't work
}
Outside the template the functions are in..
template<class x=""> CClass<x>::CClass()
{
}
...
Now because everything worked before, and I only added the syntax for the template, I know that it must be the syntax or something.
The compiler error is:
error LNK2001: unresolved external symbol ...
What I really need is exactly what the syntax needs to be. I can't find this anywhere at the moment. What I changed seemed very straight forward.
Appreciate any help to clearing this syntax up. Thanks!!
|
|
|
|
|
Please repost and check the Display this message as-is (no HTML) box so your template params show up properly.
--Mike--
I'm bored... Episode I bored.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
OK. This is the second try.
I had a program with CClass and CBaseClass classes DONE without Template and it works fine. Now I changed things to:
template<class X> CBaseClass
{
...
}
Outside the template the functions are in..
template<class X> void CBaseClass<X>::Function()
{
...
}
I know the base baseclass declaration is OK
AND
template<class X> CClass: public CBaseClass<X>
{
//I tried several syntax for the constructor and other fuunctions
CClass();
virtual ~CClass();
OR
CClass():CBaseClass<X>();
virtual ~CClass():CBaseClass<X>();
void Function():CClass::Function<X>()
//Both don't work
}
Outside the template the functions are in..
template<class X> CClass<X>::CClass()
{
}
...
Now because everything worked before, and I only added the syntax for the template, I know that it must be the syntax or something.
The compiler error is:
error LNK2001: unresolved external symbol ...
What I really need is exactly what the syntax needs to be. I can't find this anywhere at the moment. What I changed seemed very straight forward.
|
|
|
|
|
template <class X> class CBaseClass
{
};
template <class X> class CClass : public CBaseClass<X>
{
CClass();
virtual ~CClass();
void Function();
};
template <class X>
CClass<X>::CClass() : CBaseClass<X>()
{ }
template <class X>
CClass<X>::~CClass()
{ }
template <class X>
void CClass<X>::Function()
{ }
|
|
|
|
|
Hi Michael.
Thanks for the patience and help thus far.
From what I can see, only the template declaration and the Constructor for the derived class has different syntax. The others look normal template syntax. I tried this but am getting:
error LNK2001: unresolved external symbol "public: virtual __thiscall CTCRSSRecoilCoilReport<class CCircBufferT<float,struct _DATA_STRUCTURE_> >::~CTCRSSRecoilCoilReport<class CCircBufferT<float,struct _DATA_STRUCTURE_> >(void)" (?
?1?$CTCRSSRecoilCoilReport@V?$CCircBufferT@MU_DATA_STRUCTURE_@@@@@@UAE@XZ)
error LNK2001: unresolved external symbol "public: virtual void __thiscall CTCRSSRecoilCoilReport<class CCircBufferT<float,struct _DATA_STRUCTURE_> >::EndCoilReport(class CString,struct _RECOILING_COIL_REPORT_HOLDER_ *)" (?EndCoilR
eport@?$CTCRSSRecoilCoilReport@V?$CCircBufferT@MU_DATA_STRUCTURE_@@@@@@UAEXVCString@@PAU_RECOILING_COIL_REPORT_HOLDER_@@@Z)
error LNK2001: unresolved external symbol "public: __thiscall CTCRSSRecoilCoilReport<class CCircBufferT<float,struct _DATA_STRUCTURE_> >::CTCRSSRecoilCoilReport<class CCircBufferT<float,struct _DATA_STRUCTURE_> >(void)" (??0?$CTCRS
SRecoilCoilReport@V?$CCircBufferT@MU_DATA_STRUCTURE_@@@@@@QAE@XZ)
...
from the locations where I am calling the classes. I am not sue what this means unless the way you call it is different then normal template calling (Which is different only in declaration).
I am not sure what the Link 2001 error means. I know that the program did work right before. It seems like the program is getting errors from just calling the classes so I must not be declaring things right somewhere.
Thanks.
|
|
|
|
|
|
Hi Micheal. Thanks. I will try this.
|
|
|
|
|
Hi Michael.
I tried this. I ended PUT ALL the functions insides the template itself all in the header file. But it is still the same Link 2001 unresolved external symbol error. I can't understand it. I never had to put all the functions in the template in the heade file if it is not derived from it. It works fine.
I am really confused now as to what is actually the problem. It must be syntax. Right now I just want to change it to this class and its derived class to a template. I am not actually using the <class X> part yet meaning it should still work as before without the template declarations.
Any other ideas? Appreciate your help through this
|
|
|
|
|
I include a gif resource into my project but every time I build it the gif becomes 0 kb and when I try to view it in windows it says no preview available. I am using MS VC++ 6.0 w/ service pack 5. Anyone else with this problem?
|
|
|
|
|
http://www.wintellect.com/forum/topic.asp?TOPIC_ID=1132
so im creating this System Wide Keyboard Hooking Function, and i thought it would catch everything , but this group is having a discussion about it, and one says a SWKH will not catch a Ctrl-Alt-Delete, is that true??
todo....
:: insert inpirational text here ::
|
|
|
|
|
Of course not. The whole point of C+A+D is that it's secure - when you press it, only the OS responds to it.
--Mike--
I'm bored... Episode I bored.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Believe me:
if you want to catch Ctrl+Alt+Del you must do one of this things:
1. Create a Gina DLL.
2. Get a Gina DLL from somewhere.
the reason is clear:
In order to be secure its forbidden to get acces directly from an app to the Login part of the OS.
You've got to do it via a GINA that must be installed in the OS copying it somewhere and giving it's right path in the registry.
Take a look at the MSDN in order to find out more.
hope this helps...
|
|
|
|
|
|
|
Hey guys,
I'm having some trouble with a std::map object I'm trying to use. Can any STL guys out there see something I'm doing wrong in my code. I've been debugging this for a couple hours now, stepping through STL code (which isn't fun!).
All I'm trying to do is associate a structure with a string. So, I insert a value_type with a string and a structure, then I try to look up the exact same string, and I get an invalid iterator. One wierd thing, is that it works perfectly for the first item I insert. Looking at the guts of the tree, I can see that the second object is there, it just checks the wrong side of the tree when it goes to look it up .
typedef basic_string<TCHAR> CTCharString;
struct CTCharStringLess : public binary_function<CTCharString, CTCharString, bool>
{
bool operator()(const CTCharString& x, const CTCharString& y) const
{
return _tcscmp( x.c_str(), y.c_str() );
}
};
typedef struct tagFoo
{
long Bar;
}Foo;
typedef map<CTCharString,Foo,CTCharStringLess> CStdMapStringToStruct;
CStdMapStringToStruct MyMap;
Foo stMyStruct;
MyMap.insert( CStdMapStringToStruct::value_type( _T("dummy_item", stMyStruct ) );
CStdMapStringToStruct::iterator oIter = MyMap.find( _T("dummy_item") );
MyMap.insert( CStdMapStringToStruct::value_type( _T("dummy_item_2"), stMyStruct ) );
oIter = MyMap.find( _T("dummy_item_2") );
Thanks,
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|