|
Alex,
Thanks for your response, sorry, I don't know how to format my code for the post, can you please tell me how? Since I don't provide a sorting criterion when I define my map, it should use the default less <>? I don't really understand the sorting criterion very well. I can see my items don't appear to be sorted. All I want to do is insert items and find items. How should I specify it?
thanks,
Bob
|
|
|
|
|
Use the <pre> tags. You can use them on the formatting bar just above the smileys. Also you can preview the messge before it gets posted.
In a map items will be sorted by key. If you use int as keys then you need not provide a < operator. But if your are using some structs then you definitely must give a comparison method.
Best regards,
Alexandru Savescu
|
|
|
|
|
I am using a key of const char *, the data is struct. How would I specify a comparison method for char *?
thanks,
Bob
|
|
|
|
|
Taking a closer look the HTML source page I found this
typedef map<const char *, dataVector> importData;
So you are using some const char* as string. Using less on them will compare pointers and of course that your map will not look as you expect. You must compare them with strcmp . Or, easier use CString as key. It has a < operator defined that does good job.
Best regards,
Alexandru Savescu
|
|
|
|
|
Alex,
Making the key a CString worked!!! Thank you very much for your help!
Bob
|
|
|
|
|
Of course it did, I just explained the reason.
If you want to use const char* (maybe for portability) then here is an exameple from the SGI documentation
struct ltstr
{
bool operator()(const char* s1, const char* s2) const
{
return strcmp(s1, s2) < 0;
}
};
int main()
{
map <const char*, int, ltstr> mymap;
}
Best regards,
Alexandru Savescu
|
|
|
|
|
I need make a library of 16 bits in vc++. I don`t know the statements to use.
Thank in advances
|
|
|
|
|
I think C++ 1.5 was the last to support 16 bits. They still give it as part of some of the MSDN subscriptions.
Ain't nobody ever told you : There ain't no sanity clause .Groucho Marks
|
|
|
|
|
Hi friends,
How to know what are the dlls my program is using if I am creating a program in MFC? because,when I am trying to run this program on different platforms (98 or NT) I am getting different type of errors saying particular dll is missing. Why this is happening?
Thanks
Satya
|
|
|
|
|
hi,
Use Dependency Walker which comes with MS Visual Studio Tools!
Rgds,
Sharad Ganesh
|
|
|
|
|
Thanks sharad I got it.
regards
Satya
|
|
|
|
|
If I call DeleteAllItems() then rebuild the tree by adding new nodes , I subsequently get an error stating that a memory location was changed after it was deleted . Any ideas ?
Ain't nobody ever told you : There ain't no sanity clause .Groucho Marks
|
|
|
|
|
|
It throws an exception saying that heap memory has been changed after it was freed. I am not doing it , presumably the mfc framework is. Basically I have a simple dialog with a tree control . In response to various context menus I change the contents of the tree control. I do this by calling deleteAllItems() and then adding new items by pulling records from a table . When the dialog closes it is overwriting bits of the memory that where assosiated with the items I deleted .Hence the exception. I have worked around it now , but I must still be missing something obvious ?
Ain't nobody ever told you : There ain't no sanity clause .Groucho Marks
|
|
|
|
|
Andrew Torrance wrote:
but I must still be missing something obvious ?
More than likely, but we won't be able to tell without seeing the code. We're not mind-readers ya' know.
Joel Lucsy (jjlucsy@ameritech.net)
|
|
|
|
|
I draw some text on CView as shown below. How can I be able to "copy and paste" it ?
void ClassDerivedFromCView::OnDraw(CDC* pDC)
{
CFinalReport5Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDC->TextOut(20, 20, "sample text output to be copy-and-pasted");
}
rsg_dj
|
|
|
|
|
easy way: use CEditView
very hard way: use any other CView
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!
|
|
|
|
|
I tried to use the CEditView but problem is I cannot break line.
eg
SetWindowText( "this is first line and \n this is second line");
Everything appears in single line, against my wish. Please help
|
|
|
|
|
|
Hello friends,
Everytime I was interested in knowing how a Install Wizard works. knowing the OS, loading the necessary dlls, and creating the necessary directories etc. Can any body suggest some links or reading references on this? I know, there are some free wizards. I want my own. Thanks in advance.
|
|
|
|
|
it is terrible, don't study it.
the pack is targeted to both c++ and vb, for vb it is a help, for c++ it is a funny story.
to install your apps, to learn:
1. how to create short cut
2. how to add short cut to start menu and desktop
3. some copy file jobs.
that is all.
includeh10
|
|
|
|
|
I think you may have a hard time finding anyone to help you re-invent the wheel . I have wanted to do things before that are already done well just so I could learn, but in general, people don't seem to have much to offer in that type of situation. I'll do my best to help, but I'm no expert on the subject.
First of all, I've never seen documentaion on this before, so you're on your own to track that down. Here's how I see it, though.
It seems to me that there are different paradigms for creating an installer creation tool. Microsoft, for instance provides a way to create an .msi installer with their installer tool that works with InterDev. Their model creates a virtual workspace in which there is a virtual filesystem, a virtual registry, and virtual installer screens. It is not highly versatile, but the model they use is very intuitive and great for simple installers.
On the other hand, you have a product like InstallShield which is far more robust, but not quite as intuitive. They give you the ability to script more complex things with a VB like programming language. The model they use leaves a lot to be desired in my opinion, but it is an effective tool once you learn it.
There are many others that I won't mention. The point here, I think, is that you want to roll your own. I think you have to just break down the problem in it's component parts and go from there. Answer these questions:
1. How do I find out the system directory programatically?
2. How do I create directories programmatically?
3. How do I register activex controls or dlls programatically?
4. How do I find out which OS my installer is running on programmatically?
5. How do I create shortcuts programmatically?
Once you know the answer to these questions, you can start coding it. However, you will also have to decide how you're going to create your executable that the end-user will install. I think what you get with many installers, is a way to bundle all of your files into a single file that can be executed. Keep in mind, I've never done this so it's probably speculation, but I believe what happens is this:
1. The installer creation tool creates the executable that is going to do the installing.
2. It also generates a layout file that contains directives as to where to place the files as well as registry settings. It becomes a script that your installer reads.
3. It then concatenates each of the additional files (e.g. the application .exe file, any .dll or .ocx files, etc) to the end of the installer .exe file keeping track of the offset of each file while it adds them.
Again, I have never done this, so it may not be the best information, but this is probably how I would approach it given your scenario.
Best of luck to you and Best Regards.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Hi!
I need a control to explore the hard drive and select files.
Can anyone suggest a control like this?
Thank you in advance
|
|
|
|
|
|
Thank you, i'll try it out!
|
|
|
|