🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #13498

Re: Problem with Stringlist in service application

#13498
From: Victor G. Baron
Date: Sat, 11 Oct 2003 05:31
137 lines
3814 bytes
OK - 

In the header I have this:



//---------------------------------------------------------------------------
#ifndef svc1H
#define svc1H
//---------------------------------------------------------------------------
#include <SysUtils.hpp>
#include <Classes.hpp>
#include <StdCtrls.hpp>
#include <SvcMgr.hpp>
#include <vcl.h>
#include <stdio.h>
//---------------------------------------------------------------------------
class TService1 : public TService
{
__published:    // IDE-managed Components
   void __fastcall ServiceStart(TService *Sender, bool &Started);
   void __fastcall ServiceContinue(TService *Sender, bool &Continued);
   void __fastcall ServicePause(TService *Sender, bool &Paused);
   void __fastcall ServiceStop(TService *Sender, bool &Stopped);
private:        // User declarations
public:         // User declarations
	__fastcall TService1(TComponent* Owner);
	TServiceController __fastcall GetServiceController(void);

	friend void __stdcall ServiceController(unsigned CtrlCode);
};
//---------------------------------------------------------------------------
class TConvThread : public TThread

{
private:
protected:
      void __fastcall Execute();
public:
        __fastcall TConvThread(bool CreateSuspended);

        TStringList* inputfile;
        String input_file;
        String output_file;
};
//---------------------------------------------------------------------------
extern PACKAGE TService1 *Service1;
//---------------------------------------------------------------------------
#endif


and in the thread constructor I have:

//---------------------------------------------------------------------------
__fastcall TConvThread::TConvThread(bool CreateSuspended)

        : TThread(CreateSuspended)
{
   // set up the filenames - hardcoded

   input_file ="C:\auth_user_file.txt";
   output_file = "H:\\Borland\\CBuilder5\\Projects\\VPC_CONV\\onlineusers.txt";

}

and the execute function:

void __fastcall TConvThread::Execute()

{


  inputfile = new TStringList();

  while (!Terminated)
  {


   // here we do the work
   // read the inputfile to a stringlist
   // process each record creating a single string
   // result which is saved



   FILE* out;
   String Result, temp, parse;
   char* p;

   inputfile->Sorted = true;
   Result = "";

   inputfile->LoadFromFile(input_file); //  crashes here

/*******

parsing goes here

write file back etc


********/





   // and clean up the string list
   delete inputfile;



HTH - thanx


    Beep();
    Sleep(6000);   // cycle every ten minutes
  }

}














-- 
Vic Baron
I haven't lost my mind, it's backed up on disk somewhere!
Technical Details
Message-ID: <525fovoj0ltdsbhpo7vo2tsen3nrsa2g1l@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.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
References: <ppueovg2k6grk500sgq49urri491tltrk7@4ax.com> <3f87807f$1@newsgroups.borland.com> <rn2fovgubqp92b3gv6te6rhj7kh0ih4p30@4ax.com> <3f8791ec@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,4f6a692a96789751
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-10-10 22:38:53 PST
From: Victor G. Baron <vgbaron@hotmail.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Problem with Stringlist in service application
Date: Fri, 10 Oct 2003 22:31:30 -0700
Message-ID: <525fovoj0ltdsbhpo7vo2tsen3nrsa2g1l@4ax.com>
References: <ppueovg2k6grk500sgq49urri491tltrk7@4ax.com> <3f87807f$1@newsgroups.borland.com> <rn2fovgubqp92b3gv6te6rhj7kh0ih4p30@4ax.com> <3f8791ec@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.8/32.548
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 66.120.230.18
X-Trace: newsgroups.borland.com 1065850280 66.120.230.18 (10 Oct 2003 22:31:20 -0700)
Lines: 137
Path: arc1-ca.pugleaf.net!archiver1.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