|
It crashes at here:
} while (_findnext (File_handle, &file_s) == 0);<br />
Maxwell Chen
|
|
|
|
|
Why implement a binary tree yourself? Use std::set or std::multiset . Then you get a self balancing binary tree instead of you home spun version which isn't self balancing and thus can degenerate to linear rather then logarithmic performance. Your program is written at an unnecessarily low level - A common mistake with C++ programmers, especially those with a background in C (in my opinion).
Steve
|
|
|
|
|
Stephen Hewitt wrote: Your program is written at an unnecessarily low level - A common mistake with C++ programmers, especially those with a background in C (in my opinion)
This is so true. It takes time for him to catch up this sense.
But maybe he hadn't known the existing one, std::set , to use.
Sometimes it might be of fun to code one's own toy (BTree in this case) to enjoy how it works.
Maxwell Chen
|
|
|
|
|
Does the "crash" occur while adding nodes to the tree, printing the nodes, or scanning the folders? Please try to narrow it down a bit further so that we don't have to examine unnecessary code. You'll get much more help that way.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
program does not produce any output i dnt knwo where it is getting generated.
|
|
|
|
|
By following what I described in the thread just below. Use your debugger !
|
|
|
|
|
But you mentioned a compiler error. What is it? It will be a 4-digit number preceded by a C.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
This instruction at "0X77f8910e" referenced memory at "0xc7c7cf0".The memory could not be "read".
|
|
|
|
|
That's a run-time error, not a compilation error. There's a big difference between the two.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
parichaybp wrote: while (fscanf(fp, "%s", &words)!= -1) //while not the end of the file
fscanf() can also return 0 , which indicates a potential problem, but the while loop would continue. Is this intentional?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
parichaybp wrote: root1 = addtree (root1, words);
Why do you keep reassigning a new value to root1 ? That variable should point to the root of the tree no matter what.
parichaybp wrote: #define MAX_LEN 100
Paths can be longer than 100 characters. Use MAX_PATH instead.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
parichaybp wrote: if (strcmp (file_s.name, ".") == 0 || strcmp (file_s.name, "..") == 0)
This can be shortened to just a single comparison:
if (file_s.name[0] == '.') This does nothing for your problem, but it does help to remove unnecessary code.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Have you tried just navigating through the files/folders without adding anything to the tree data structure?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Geez... Why don't you use the debugger for that purpose ? It is the purpose of such a tool and it is much more helpfull (and faster) than posting a message on a forum.
We cannot tell the problem just by what you posted (and don't post the complete code because the problem will be the same).
Start your debugger (press F5) and see where it crashes. You can look through the call stack windows to see in which function it crashes. You can also set breakpoints (F9) to step into your code to see where it crashes.
|
|
|
|
|
This is the think that should be done before posting your coding problem on codeproject. This helps alot...
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
It crashes at here:
} while (_findnext (File_handle, &file_s) == 0);
Maxwell Chen
|
|
|
|
|
Hi,
Can u plz tell me how to correct the error??
|
|
|
|
|
hai,
I dont know the difference between what is the SendMessage and PostMessage and Difference between SendMessage and Postmessage.
Krishna
|
|
|
|
|
It can be said that SendMessage is Synchronous in nature and PostMessage is Asynchronous in nature.
Check out this[^] and this[^]
Please google before posting a question.
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
SendMessage(..)
The SendMessage function sends the message to a window or windows. It calls the window procedure for the specified window and does not return until the window procedure has processed the message.
PostMessage(..)
The PostMessage function places a message in the message queue associated with the thread that created the specified window and returns without waiting for the thread to process the message.
For more information search on the following site with SendMessage:
http://www.msdn.microsoft.com
Regards
Amar
|
|
|
|
|
I can give you an example to understand when use the functions:
If you want that an object (CWnd) close itself without problems, probally the best solution is Postmessage(WM_CLOSE). Elseway if in a member (of this object) function you use Sendmessage the object will be destroyed before that the function ends, and it is probable that after Sendmessage some operations will be done on the members of this object. So this is a cause of a crash.
Have a nice code day
-- modified at 9:27 Friday 14th April, 2006
|
|
|
|
|
Having problems about right clicking on an item in a tree control. The item
that is clicked on is not the right one.
If I have three items in a tree.
Here is my problem. I click on the first item with normal click. I click on
the third item with the right click mouse. In this event I had a messagebox
telling me which item is selected, and this one comes out with the first
item no mather what. I also tried to get into the OnSelchangedItemfieldtree
function - but with no luck.
How can I right click on the third one and get its name out of it? Does
anyone know?
More relaxed the person,high is his status.
|
|
|
|
|
For handling right click override Tree control's OnRButtonDown.
In this function HitTest with the point so that u will get the selected item and then use GetItemText to get name of the item.
void CExplorerView::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
// To get selected item
HTREEITEM hTreeItem = GetTreeCtrl().HitTest(point);
GetTreeCtrl().SelectItem(hTreeItem);
CString cstrItemText = GetTreeCtrl().GetItemText(hTreeItem);
CTreeView::OnRButtonDown(nFlags, point);
}
Regards
Amar
|
|
|
|
|
I am unable to read .PST files using VC++. I am developing an application like Outlook.
In that I have to read the outlook mails into my application. Please give any suggesstions.
knarasimharao
|
|
|
|
|
K. narasimharao wrote: I am unable to read .PST files using VC++. I am developing an application like Outlook.
In that I have to read the outlook mails into my application. Please give any suggesstions.
Use MAPI to access the PST file.
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|