Console Application
-
Hi, i written a console application from VC++, program is to generate a binary tree. program will take a directory as a input and generate a binary tree of words.. problem is if i give a small directory with 5 to 10 files program generates the binary tree properly if i select a big folder it gives below error can anyone help with this..??? ===================================================== This instruction at "0X77f8910e" referenced memory at "0xc7c7cf0".The memory could not be "read". Click OK to terminate the program Click on cancel to debug the program OK CANCEL ======================================================= Regards, Parichay.
-
Hi, i written a console application from VC++, program is to generate a binary tree. program will take a directory as a input and generate a binary tree of words.. problem is if i give a small directory with 5 to 10 files program generates the binary tree properly if i select a big folder it gives below error can anyone help with this..??? ===================================================== This instruction at "0X77f8910e" referenced memory at "0xc7c7cf0".The memory could not be "read". Click OK to terminate the program Click on cancel to debug the program OK CANCEL ======================================================= Regards, Parichay.
You may have to check those size indicators / holders in your code as array boundary or something. :-D
Maxwell Chen
-
You may have to check those size indicators / holders in your code as array boundary or something. :-D
Maxwell Chen
Hi , Thanks for the reply. Can u plz check my code and tell me where the error is and why it is getting generated..?// /// Program to Generate Binary Tree of multiple files and multiple words. #include #include #include #include #include #include #include #include #define MAXWORD 100 struct tnode *addtree(struct tnode *,char *); void treeprint(struct tnode *); #define length (80) struct tnode { char *word; struct tnode *left; struct tnode *right; }; struct tnode *root1 = NULL; struct tnode *talloc(void) { return (struct tnode *) malloc(sizeof(struct tnode)); } char *strdup(char *s) { char *p; p=(char *) malloc(strlen(s)+1); if(p!=NULL) strcpy(p,s); return p; } //addtree add a node with w at or below p struct tnode *addtree(struct tnode *p,char *w) { int cond; if(p==NULL) { p=talloc(); p->word=strdup(w); p->left=p->right=NULL; } else if((cond=strcmp(w,p->word)) == 0) ; else if(cond < 0) p->left=addtree(p->left,w); else p->right=addtree(p->right,w); return p; } // treeprint : in order void treeprint(struct tnode *p) { if(p!=NULL) { treeprint(p->left); printf("%s\n",p->word); treeprint(p->right); } } void ListWords (char *); #define MAX_LEN 100 int main () { char dir[] = "D://Parichay/"; ListWords(dir); printf("\n\n\t\t Binary Tree :- Each Node Contains 1 word.\n\n"); treeprint(root1); return 0; } /////////Function to list words////// void ListWords (char *dir) { struct _finddata_t file_s; long File_handle; char name[MAX_LEN], words[length]; int j,size; _chdir(dir); if( (File_handle = _findfirst( "*", &file_s )) == -1L ) { printf( "No files in current directory!\n" ); } else if (file_s.attrib & _A_NORMAL) { sprintf (name, "%s",dir); //root = addtree (root, name); //////////////// FILE *fp; fp = fopen(name, "r"); if(fp == NULL) { printf("\n\n Message from _A_NORMAL."); printf("\n\nERROR: could not open file"); exit(EXIT_FAILURE); } else while (fscanf(fp, "%s", &words)!= -1) //while not the end of the file { size = strlen(words); /*determines length of each string */ for(j = 0; j
-
Hi , Thanks for the reply. Can u plz check my code and tell me where the error is and why it is getting generated..?// /// Program to Generate Binary Tree of multiple files and multiple words. #include #include #include #include #include #include #include #include #define MAXWORD 100 struct tnode *addtree(struct tnode *,char *); void treeprint(struct tnode *); #define length (80) struct tnode { char *word; struct tnode *left; struct tnode *right; }; struct tnode *root1 = NULL; struct tnode *talloc(void) { return (struct tnode *) malloc(sizeof(struct tnode)); } char *strdup(char *s) { char *p; p=(char *) malloc(strlen(s)+1); if(p!=NULL) strcpy(p,s); return p; } //addtree add a node with w at or below p struct tnode *addtree(struct tnode *p,char *w) { int cond; if(p==NULL) { p=talloc(); p->word=strdup(w); p->left=p->right=NULL; } else if((cond=strcmp(w,p->word)) == 0) ; else if(cond < 0) p->left=addtree(p->left,w); else p->right=addtree(p->right,w); return p; } // treeprint : in order void treeprint(struct tnode *p) { if(p!=NULL) { treeprint(p->left); printf("%s\n",p->word); treeprint(p->right); } } void ListWords (char *); #define MAX_LEN 100 int main () { char dir[] = "D://Parichay/"; ListWords(dir); printf("\n\n\t\t Binary Tree :- Each Node Contains 1 word.\n\n"); treeprint(root1); return 0; } /////////Function to list words////// void ListWords (char *dir) { struct _finddata_t file_s; long File_handle; char name[MAX_LEN], words[length]; int j,size; _chdir(dir); if( (File_handle = _findfirst( "*", &file_s )) == -1L ) { printf( "No files in current directory!\n" ); } else if (file_s.attrib & _A_NORMAL) { sprintf (name, "%s",dir); //root = addtree (root, name); //////////////// FILE *fp; fp = fopen(name, "r"); if(fp == NULL) { printf("\n\n Message from _A_NORMAL."); printf("\n\nERROR: could not open file"); exit(EXIT_FAILURE); } else while (fscanf(fp, "%s", &words)!= -1) //while not the end of the file { size = strlen(words); /*determines length of each string */ for(j = 0; j
As you've seen, "<" and ">" are gone. Would you just send me the cpp file to (sautiller @ yahoo . com)? I will check your code. :-D
Maxwell Chen
-
Hi, i written a console application from VC++, program is to generate a binary tree. program will take a directory as a input and generate a binary tree of words.. problem is if i give a small directory with 5 to 10 files program generates the binary tree properly if i select a big folder it gives below error can anyone help with this..??? ===================================================== This instruction at "0X77f8910e" referenced memory at "0xc7c7cf0".The memory could not be "read". Click OK to terminate the program Click on cancel to debug the program OK CANCEL ======================================================= Regards, Parichay.
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.
-
Hi , Thanks for the reply. Can u plz check my code and tell me where the error is and why it is getting generated..?// /// Program to Generate Binary Tree of multiple files and multiple words. #include #include #include #include #include #include #include #include #define MAXWORD 100 struct tnode *addtree(struct tnode *,char *); void treeprint(struct tnode *); #define length (80) struct tnode { char *word; struct tnode *left; struct tnode *right; }; struct tnode *root1 = NULL; struct tnode *talloc(void) { return (struct tnode *) malloc(sizeof(struct tnode)); } char *strdup(char *s) { char *p; p=(char *) malloc(strlen(s)+1); if(p!=NULL) strcpy(p,s); return p; } //addtree add a node with w at or below p struct tnode *addtree(struct tnode *p,char *w) { int cond; if(p==NULL) { p=talloc(); p->word=strdup(w); p->left=p->right=NULL; } else if((cond=strcmp(w,p->word)) == 0) ; else if(cond < 0) p->left=addtree(p->left,w); else p->right=addtree(p->right,w); return p; } // treeprint : in order void treeprint(struct tnode *p) { if(p!=NULL) { treeprint(p->left); printf("%s\n",p->word); treeprint(p->right); } } void ListWords (char *); #define MAX_LEN 100 int main () { char dir[] = "D://Parichay/"; ListWords(dir); printf("\n\n\t\t Binary Tree :- Each Node Contains 1 word.\n\n"); treeprint(root1); return 0; } /////////Function to list words////// void ListWords (char *dir) { struct _finddata_t file_s; long File_handle; char name[MAX_LEN], words[length]; int j,size; _chdir(dir); if( (File_handle = _findfirst( "*", &file_s )) == -1L ) { printf( "No files in current directory!\n" ); } else if (file_s.attrib & _A_NORMAL) { sprintf (name, "%s",dir); //root = addtree (root, name); //////////////// FILE *fp; fp = fopen(name, "r"); if(fp == NULL) { printf("\n\n Message from _A_NORMAL."); printf("\n\nERROR: could not open file"); exit(EXIT_FAILURE); } else while (fscanf(fp, "%s", &words)!= -1) //while not the end of the file { size = strlen(words); /*determines length of each string */ for(j = 0; j
-
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
-
edit your message and check the
Ignore HTML tags in this message (good for code snippets)
so that < and > aren't considered as html tags. :zzz:Hi V2, i have sent again hope u get the solution. /// Program to Generate Binary Tree of multiple files and multiple words. #include #include #include #include #include #include #include #include #define MAXWORD 100 struct tnode *addtree(struct tnode *,char *); void treeprint(struct tnode *); #define length (80) struct tnode { char *word; struct tnode *left; struct tnode *right; }; struct tnode *root1 = NULL; struct tnode *talloc(void) { return (struct tnode *) malloc(sizeof(struct tnode)); } char *strdup(char *s) { char *p; p=(char *) malloc(strlen(s)+1); if(p!=NULL) strcpy(p,s); return p; } //addtree add a node with w at or below p struct tnode *addtree(struct tnode *p,char *w) { int cond; if(p==NULL) { p=talloc(); p->word=strdup(w); p->left=p->right=NULL; } else if((cond=strcmp(w,p->word)) == 0) ; else if(cond < 0) p->left=addtree(p->left,w); else p->right=addtree(p->right,w); return p; } // treeprint : in order void treeprint(struct tnode *p) { if(p!=NULL) { treeprint(p->left); printf("%s\n",p->word); treeprint(p->right); } } void ListWords (char *); #define MAX_LEN 100 int main () { char dir[] = "D://Paruichay//"; ListWords(dir); printf("\n\n\t\t Binary Tree :- Each Node Contains 1 word.\n\n"); treeprint(root1); return 0; } /////////Function to list words////// void ListWords (char *dir) { struct _finddata_t file_s; long File_handle; char name[MAX_LEN], words[length]; int j,size; _chdir(dir); if( (File_handle = _findfirst( "*", &file_s )) == -1L ) { printf( "No files in current directory!\n" ); } else if (file_s.attrib & _A_NORMAL) { sprintf (name, "%s",dir); //root = addtree (root, name); //////////////// FILE *fp; fp = fopen(name, "r"); if(fp == NULL) { printf("\n\n Message from _A_NORMAL."); printf("\n\nERROR: could not open file"); exit(EXIT_FAILURE); } else while (fscanf(fp, "%s", &words)!= -1) //while not the end of the file { size = strlen(words); /*determines length of each string */ for(j = 0; j
-
Hi V2, i have sent again hope u get the solution. /// Program to Generate Binary Tree of multiple files and multiple words. #include #include #include #include #include #include #include #include #define MAXWORD 100 struct tnode *addtree(struct tnode *,char *); void treeprint(struct tnode *); #define length (80) struct tnode { char *word; struct tnode *left; struct tnode *right; }; struct tnode *root1 = NULL; struct tnode *talloc(void) { return (struct tnode *) malloc(sizeof(struct tnode)); } char *strdup(char *s) { char *p; p=(char *) malloc(strlen(s)+1); if(p!=NULL) strcpy(p,s); return p; } //addtree add a node with w at or below p struct tnode *addtree(struct tnode *p,char *w) { int cond; if(p==NULL) { p=talloc(); p->word=strdup(w); p->left=p->right=NULL; } else if((cond=strcmp(w,p->word)) == 0) ; else if(cond < 0) p->left=addtree(p->left,w); else p->right=addtree(p->right,w); return p; } // treeprint : in order void treeprint(struct tnode *p) { if(p!=NULL) { treeprint(p->left); printf("%s\n",p->word); treeprint(p->right); } } void ListWords (char *); #define MAX_LEN 100 int main () { char dir[] = "D://Paruichay//"; ListWords(dir); printf("\n\n\t\t Binary Tree :- Each Node Contains 1 word.\n\n"); treeprint(root1); return 0; } /////////Function to list words////// void ListWords (char *dir) { struct _finddata_t file_s; long File_handle; char name[MAX_LEN], words[length]; int j,size; _chdir(dir); if( (File_handle = _findfirst( "*", &file_s )) == -1L ) { printf( "No files in current directory!\n" ); } else if (file_s.attrib & _A_NORMAL) { sprintf (name, "%s",dir); //root = addtree (root, name); //////////////// FILE *fp; fp = fopen(name, "r"); if(fp == NULL) { printf("\n\n Message from _A_NORMAL."); printf("\n\nERROR: could not open file"); exit(EXIT_FAILURE); } else while (fscanf(fp, "%s", &words)!= -1) //while not the end of the file { size = strlen(words); /*determines length of each string */ for(j = 0; j
Did you try to press the cancel button to see where it crashes ? It is VERY helpfull for us to know where (man, I don't want to go through all this code to find the problem)
-
Did you try to press the cancel button to see where it crashes ? It is VERY helpfull for us to know where (man, I don't want to go through all this code to find the problem)
i get the error message soon after run (Ctrl + F5 ) it does not produce any output
-
i get the error message soon after run (Ctrl + F5 ) it does not produce any output
Start your debugger and tell us exactly at which line of code it crashes (press F5 instead of Ctrl + F5). * me :sigh: *
-
Hi , Thanks for the reply. Can u plz check my code and tell me where the error is and why it is getting generated..?// /// Program to Generate Binary Tree of multiple files and multiple words. #include #include #include #include #include #include #include #include #define MAXWORD 100 struct tnode *addtree(struct tnode *,char *); void treeprint(struct tnode *); #define length (80) struct tnode { char *word; struct tnode *left; struct tnode *right; }; struct tnode *root1 = NULL; struct tnode *talloc(void) { return (struct tnode *) malloc(sizeof(struct tnode)); } char *strdup(char *s) { char *p; p=(char *) malloc(strlen(s)+1); if(p!=NULL) strcpy(p,s); return p; } //addtree add a node with w at or below p struct tnode *addtree(struct tnode *p,char *w) { int cond; if(p==NULL) { p=talloc(); p->word=strdup(w); p->left=p->right=NULL; } else if((cond=strcmp(w,p->word)) == 0) ; else if(cond < 0) p->left=addtree(p->left,w); else p->right=addtree(p->right,w); return p; } // treeprint : in order void treeprint(struct tnode *p) { if(p!=NULL) { treeprint(p->left); printf("%s\n",p->word); treeprint(p->right); } } void ListWords (char *); #define MAX_LEN 100 int main () { char dir[] = "D://Parichay/"; ListWords(dir); printf("\n\n\t\t Binary Tree :- Each Node Contains 1 word.\n\n"); treeprint(root1); return 0; } /////////Function to list words////// void ListWords (char *dir) { struct _finddata_t file_s; long File_handle; char name[MAX_LEN], words[length]; int j,size; _chdir(dir); if( (File_handle = _findfirst( "*", &file_s )) == -1L ) { printf( "No files in current directory!\n" ); } else if (file_s.attrib & _A_NORMAL) { sprintf (name, "%s",dir); //root = addtree (root, name); //////////////// FILE *fp; fp = fopen(name, "r"); if(fp == NULL) { printf("\n\n Message from _A_NORMAL."); printf("\n\nERROR: could not open file"); exit(EXIT_FAILURE); } else while (fscanf(fp, "%s", &words)!= -1) //while not the end of the file { size = strlen(words); /*determines length of each string */ for(j = 0; j
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
-
Start your debugger and tell us exactly at which line of code it crashes (press F5 instead of Ctrl + F5). * me :sigh: *
hope this will help u. after F5 Loaded 'C:\WINNT\system32\ntdll.dll', no matching symbolic information found. Loaded 'C:\WINNT\system32\KERNEL32.DLL', no matching symbolic information found. First-chance exception in OnlyWords.exe (NTDLL.DLL): 0xC0000005: Access Violation. The thread 0x258 has exited with code -1073741510 (0xC000013A). The program 'D:\Parichay\OnlyWords\Debug\OnlyWords.exe' has exited with code -1073741510 (0xC000013A).
-
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.
-
hope this will help u. after F5 Loaded 'C:\WINNT\system32\ntdll.dll', no matching symbolic information found. Loaded 'C:\WINNT\system32\KERNEL32.DLL', no matching symbolic information found. First-chance exception in OnlyWords.exe (NTDLL.DLL): 0xC0000005: Access Violation. The thread 0x258 has exited with code -1073741510 (0xC000013A). The program 'D:\Parichay\OnlyWords\Debug\OnlyWords.exe' has exited with code -1073741510 (0xC000013A).
:omg: :omg: :(( :(( :(( You are kiding aren't you ?? I simply ask you to tell us where the debugger stops when it crashes. At which line of code in your program excactly (there is a yellow arrow next to your code) ? I think your eally need to learn a little bit to work with your debugger. I cannot imagine my life without one ;P. No seriously, try to play a little bit with your debugger to see how to use it. It will be a very good friend that will help you in many many situations.
-
:omg: :omg: :(( :(( :(( You are kiding aren't you ?? I simply ask you to tell us where the debugger stops when it crashes. At which line of code in your program excactly (there is a yellow arrow next to your code) ? I think your eally need to learn a little bit to work with your debugger. I cannot imagine my life without one ;P. No seriously, try to play a little bit with your debugger to see how to use it. It will be a very good friend that will help you in many many situations.
77F8910E cmp dword ptr [edx+14h],0 after F5 arrow stopes here .... i have just started learning VC++ so i have very less idea abt Debuggers..
-
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 !
-
77F8910E cmp dword ptr [edx+14h],0 after F5 arrow stopes here .... i have just started learning VC++ so i have very less idea abt Debuggers..
Ok, so it is not directly in your code probably. Now, put a breakpoint at the very begining of your program (by going on the line and pressing F9). Then ,put several breakpoints in relevant points in your program. Each time you press F5, the programm will advance to the next bbreakpoint. And there, you can watch to your variables and things like that. Try to play with it and understand how it works, it is really usefull and it will really help you a lot !
-
program does not produce any output i dnt knwo where it is getting generated.
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
-
Ok, so it is not directly in your code probably. Now, put a breakpoint at the very begining of your program (by going on the line and pressing F9). Then ,put several breakpoints in relevant points in your program. Each time you press F5, the programm will advance to the next bbreakpoint. And there, you can watch to your variables and things like that. Try to play with it and understand how it works, it is really usefull and it will really help you a lot !
Thanks for the inforamtion. it will help me a lot.... i will try to do that..