|
The std::list container doesn't seem to have a way to locate an item in the list
Bob Ciora
|
|
|
|
|
Use the STL algorithm find() , it works on all STL containers.
|
|
|
|
|
Maybe a further clarification of the problem is in order. It sounds sort of like an axis sort, but I'm not sure...
- In what way do you specify uniqueness of the objects? For example, is modelName unique for each entry in the list or can multiple objects have the same modelName ?
- If modelName is unique across all entries in the list, can multiple objects exist at the same (num1,num2) position? Or is this the condition you're trying to prevent?
Bob Ciora
|
|
|
|
|
Is it possible to get the address of a character array and assign it to an int?
The following code doesn't compile because testptr should be "char * testptr".
#include "stdafx.h"
int main(int argc, char* argv[])
{
char test[10] = "hello";
int testptr=0;
testptr = &test;
return 0;
}
|
|
|
|
|
You can get the raw value of a pointer by casting it to an unsigned integral type that is the same size as a pointer. In MSVC this is unsigned , although in Windows code you should use DWORD_PTR instead for Win32/64 compatibility.
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb
Magnae clunes mihi placent, nec possum de hac re mentiri.
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Thanks for the tip, I'm actually using ILE C on an AS/400.
But I was testing this concept using vc++.
I didn't even think about the fact that int is signed.
Now the bad news, works great in vc++, didn't work on the 400. It compiles and runs, but the value isn't correct.
I might experiment with casting it into some other types and see what happens.
Thanks,
Erik
|
|
|
|
|
You can't assume that a pointer fits in an int or even unsigned int . You must find out which integral type in your C implementation is large enough to hold a pointer. Try printing the value of sizeof(void *) .
|
|
|
|
|
i want to create a MFC app. which can use ms-dos commands
i have to use which functions,etc..?
and sorry about my english
|
|
|
|
|
|
thanks!!
|
|
|
|
|
Didn't there used to be a link to that faq on the forum somewhere?
Or is it still there, and i'm blind...
Shog9
I'm not the Jack of Diamonds... I'm not the six of spades.
I don't know what you thought; I'm not your astronaut...
|
|
|
|
|
|
THere used to be a link at the top of the page when you were viewing the VC forum, but it hasn't been there for a while. I keep a link to it in my .sig though.
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb
Magnae clunes mihi placent, nec possum de hac re mentiri.
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Well, that's one thing i haven't hallucinated today at least. Any idea why it was removed?
Shog9
I'm not the Jack of Diamonds... I'm not the six of spades.
I don't know what you thought; I'm not your astronaut...
|
|
|
|
|
|
|
In my app there is an assumption that
After selecting a folder , i need to grab the one and only .xml file and parse it .
With the help of u code gurus I was able to get the folder path for the file .
Now I will not know the name of the .xml file(contained within that folder) to parse
What is the best way to
1) Make sure that there is only one file of that extension in the folder
Something like : "where count of *.xml files equals 1 "
2) Be able to get the name of the file .
|
|
|
|
|
try something like this:
WIN32_FIND_DATA FileData;
HANDLE hFind = NULL;
if (hFind = FindFirstFile("c:\\temp\\*.xml", &FileData))
{
CString filename = FileData.cFileName;
etc
FindClose(hFind);
}
Image Toolkits | Image Processing | Cleek
|
|
|
|
|
hi
In mfc way
CFileFind fFind;
BOOL bMoreFile;
bMoreFile = fFind.FindFile("C:\\YourFolder\\*.xml");
if ( bMoreFile == FALSE )
{
// no files
}
else
{
fMore = fFind.FindNextFile();
if ( fMore == FALSE )
{
// means there is only one file.
CString sFilename = fFind.GetFileName();
}
else
// can be more files
}
Hope this helps
Jetli
conclusion means Coming to wrong Decision with confidence
|
|
|
|
|
I thoght I remembered a 'beautify' command to align your code right in VC6. I can't find it in VC7 (.Net 2003), does anyone know if this is still possible?
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
|
|
BlackDice wrote:
a 'beautify' command to align your code right in VC6
what is beautify command?
Is it come with out of box VC6
Thanks
Jetli
conclusion means Coming to wrong Decision with confidence
|
|
|
|
|
yeah, I think in VC6 you can go to the 'help' item on the menu and go to 'keyboard map' or something like that, and view all the hotkeys set up for the IDE.
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
Hey,
I am looking for a solution to an eternal problem. We get complaints that our software does not look good in English when running on a Japanese OS.
Most of the problems revolve around the wizards and property pages not sizing correctly. This is because I cannot find a way for the MS PropertySheet and PropertyPage to use a more English favorable font.
Does anyone know a way to force the MS controls to use the current dialogs font and sizing and ignore the OS specifications? I should say and do this without affecting the users OS in a deterimental way. I don't want to change things on the OS out from under a user obviously.
Just as a side note, the applications are not MFC but Win32 API.
Thanks,
Brian
If you start a fire for a man, he will be warm for a day. If you start that same man on fire, he will be warm for the rest of his life.
|
|
|
|