🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.oodesign
Article #92

Function call to pull chip info & save to file. Problem shows after 45 calls.

#92
From: Ronald Boucher
Date: Fri, 27 Aug 2004 16:55
30 lines
2105 bytes
I have created a function which pull the data info from a chip and save & append to a single file, then returns a int value which indicate success/failure.

When I click the button to call the read/dump function about 45 times, the file somehow cannot be opened.  I checked out the memory address of file object "fp" (from FILE* fp declaration).  After 45 times, the fp address turned out to be null... I wonder if that means the fp address has ran out of place to open an new address?  I had to restart the application to continue with the rest of the chips after 45 calls.  How do I reset the memory address or keep it the same?  The file name is generated, depending on validity of the chip, line number, date, and the program name.  Anyone help? 

Sample Code: 
(note: output variable is char[] array for chip info.)


#include <fstream.h>

int Dump::DumpCRUM(char mode) 
// mode variable is used for either 'f'ilter or 'm'ain modules
{
  // FileName string is generated
  
  ofstream dumpfile(FileName.c_str(), ios::app);
  if (!dumpfile)
    {
      return -1;
    }
  else
    {
      dumpfile << output;
      dumpfile.close();
    }
  return 1;
}

I haven't created a constructor & destructor in this Dump class.  Perhaps this will help?
Technical Details
Message-ID: <412f677b$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10db1e,7e0fd51c39b67c62,start
X-Google-Attributes: gid10db1e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Ronald Boucher" <ron.boucher@xerox.com>
Sender: "Ronald Boucher" <ron.boucher@xerox.com>
Reply-To: "Ronald Boucher" <ron.boucher@xerox.com>
Subject: Function call to pull chip info & save to file. Problem shows after 45 calls.
Newsgroups: borland.public.cppbuilder.oodesign
X-User-Info: 13.13.137.1     
NNTP-Posting-Host: 207.105.83.66
Message-ID: <412f677b$1@newsgroups.borland.com>
Date: 27 Aug 2004 09:55:23 -0700
X-Trace: newsgroups.borland.com 1093625723 207.105.83.66 (27 Aug 2004 09:55:23 -0700)
Lines: 31
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail