Thread: File read problem

  1. #1
    Registered User ~Kyo~'s Avatar
    Join Date
    Jun 2004

    File read problem

    Ok for some reason this code is crashing while I am loading the path for the pics in no idea why really... I do know all the functions for the NPC class work I tested those first thing... I just don't see any reason it should crash while reading art/man.bmp into a 250 char array or that is where it is crashing apparently. Ideas on what might be causing this problem?

           char input[250];
           ofstream feed;
           ifstream  load;
    	feed<<"NUM NPC: "<<NumNPC<<endl;
    	npclist = new NPC*[NumNPC];
    	int nx,ny,sn;
    	for(int lnpc = 0;lnpc < NumNPC;lnpc++)
    		feed<<"NX NY SN "<<nx<<" "<<ny<<" "<<sn<<endl;
    		load>>input;//crashes here
    		feed<<"IGPIC: "<<input;
    		feed<<"DIAPIC: "<<input;
    Part of the load file where the problem is occuring.
    #NPC  2
            5   5        0             art/man.bmp          art/ness_t.bmp
            9   9        1             art/woman.bmp        art/darokin.bmp 
    The feedback file I have it dumping into.
    NUM NPC: 2
    NX NY SN 5 5 0
    Bah stupid me left a line out since I was using a NPC ** I forgot to make the loop sorry about that. Here is what I was missing.
    	feed<<"NUM NPC: "<<NumNPC<<endl;
    	npclist = new NPC*[NumNPC];
    	for(int m=0;m<NumNPC;m++)
    		npclist[m] = new NPC;
    	int nx,ny,sn;
    Last edited by ~Kyo~; 08-26-2005 at 05:13 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A development process
    By Noir in forum C Programming
    Replies: 37
    Last Post: 07-10-2011, 10:39 PM
  2. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  3. Read File Problem
    By lonewolf367 in forum C Programming
    Replies: 11
    Last Post: 11-30-2005, 10:32 AM
  4. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 10:46 AM
  5. simulate Grep command in Unix using C
    By laxmi in forum C Programming
    Replies: 6
    Last Post: 05-10-2002, 04:10 PM