JIT Debugger Error Help

This is a discussion on JIT Debugger Error Help within the C Programming forums, part of the General Programming Boards category; Here is my error.. any clues? http://i20.photobucket.com/albums/b2...Untitled-1.jpg Code: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> struct info_node { char ...

  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    43

    JIT Debugger Error Help

    Here is my error.. any clues?

    http://i20.photobucket.com/albums/b2...Untitled-1.jpg


    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <ctype.h>
    
    struct info_node
    {
        char fname[20] ;
        char lname[20] ;
        int rank ;
        float score ;
        struct info_node * next ;
    } ;
    
    
    
    struct info_node * build_list(struct info_node*);
    int main()
    {
    	struct info_node* link1 ;
     	struct info_node* top = NULL ;
    	struct info_node* node ;	
    
    	link1 = (info_node *)malloc(sizeof(info_node) ) ;
    
    	link1 = build_list(top) ;
    
    	printf( "&#37;15s %15s %4d %5.2f \n", link1->fname , link1->lname, link1->rank, link1->score ) ;
    
    return (0) ;
    
    } //end of func main()
    struct info_node * build_list(struct info_node* pnode)
    {
    
    	FILE* infile ;
    	struct info_node* top = NULL;
    	struct info_node* pre_pntr = NULL;
    	struct info_node* current_pntr = NULL ;
    	
    
    		infile = fopen("p3purge_data.txt", "r") ;
    
    
    
    while( !feof(infile) )
        {
    
    		if( top == NULL )
    		{
    			pnode = (info_node *)malloc(sizeof(info_node) ) ;
    			fscanf( infile, "%s%s%d%f", pnode->fname , pnode->lname, &pnode->rank, &pnode->score ) ;
    
    			pnode->next = NULL ;
    			top = pnode ;
    
    			current_pntr = top ;			
    		}	
    		else
    		{
    			pnode = (info_node *)malloc(sizeof(info_node) ) ;
    			fscanf( infile, "%s%s%d%f", pnode->fname , pnode->lname, &pnode->rank, &pnode->score ) ;
    
    			pre_pntr = current_pntr ;
    			current_pntr = current_pntr->next ;	
    
    			pnode->next = top ;
    			top = pnode ;
    	
    		}
    
    	}//end of !feof
    		
    		fclose(infile);
    	return(top) ;
    }

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    And so ... why didn't you actually use the debugger, instead of taking a screenshot of the system asking you whether you wanted to use the debugger?

  3. #3
    Registered User
    Join Date
    Mar 2008
    Posts
    43
    i then get an error on line 44 saying stream != NULL

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    You don't have stream anywhere in your code. And which one is line 44?

  5. #5
    Registered User
    Join Date
    Mar 2008
    Posts
    43
    nvm i got that fixed but i must have an error in my building of the list because when i return top and print the list only the last thing in the infile prints.

  6. #6
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    You build your list "backwards" (the last thing is at the top, the first thing is all the way at the end). And since you only print one thing, that's all you see.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting a C# program with a manifest file to run in the debugger
    By Xarzu Athanasop in forum C# Programming
    Replies: 0
    Last Post: 01-18-2008, 05:34 PM
  2. executing from debugger
    By hedwin in forum C++ Programming
    Replies: 8
    Last Post: 10-11-2007, 04:05 PM
  3. Replies: 3
    Last Post: 07-24-2007, 04:25 PM
  4. Just-In-Time Debugger (Visual Studio 2005)
    By Darklighter in forum Tech Board
    Replies: 2
    Last Post: 10-10-2006, 01:43 PM
  5. MSVC++ Debugger (it kills me)
    By lightatdawn in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 06-29-2002, 07:37 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21