Thread: debug assertion failed

  1. #1
    Registered User
    Join Date
    Apr 2011
    Posts
    48

    Question debug assertion failed

    Code:
    /* This program expects the name of an input file and an output
    file to be given by the user.
          Name : Dang Vo
    	  Date : 04/14/11
    */
    
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #define NUM_LINE 21
    
    typedef struct
    {
    	char states[100];
    	char cities[100];
    	int tempt;
    } INFO;
    void getData(FILE *spData, INFO list[]);  
    void insertionSort(INFO list[], int last);
    
    int main (void)
    {
    
    // Local Declarations
    
    FILE *spData = fopen("in.txt", "r");
    INFO list[NUM_LINE];
    
    
    // Statements
    getData(spData, list);
    
    return 0;
    }
    
    /*========================== getData========================
    Pre: FILE *spData
    Post: FILE *spData 
    */
    // Local Declarations
    int i;  
    
    void getData(FILE *spData, INFO list[NUM_LINE])
    {
    	if((spData = fopen("in.text", "r")) = NULL)
            printf("Error openning in.txt\n");
     
    for (i = 0; i < NUM_LINE; i++)
    fscanf(spData,"%s %s %d", list->states, list->cities, list->tempt );
    
    fclose(spData);
    return;
    }
    i have this code here when i try to run it it say debug assertion failed what did i do wrong?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. debug assertion failed
    By khoavo123 in forum C Programming
    Replies: 3
    Last Post: 04-15-2011, 09:33 AM
  2. Debug Assertion Failed
    By Freddy92 in forum C++ Programming
    Replies: 4
    Last Post: 01-30-2011, 03:52 PM
  3. debug assertion failed
    By rahulsk1947 in forum C++ Programming
    Replies: 7
    Last Post: 06-14-2009, 03:36 PM
  4. Debug assertion failed
    By Bajanine in forum Windows Programming
    Replies: 4
    Last Post: 10-17-2002, 04:34 PM