🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: memory stream parsing

#6416
From: Vladimir Stefanovic
Date: Mon, 16 May 2005 16:35
50 lines
2138 bytes
I made some late changes, and now I think that this
must work:

void __fastcall TForm1::Button1Click(TObject *Sender)
{
   TMemoryStream *MS_OLD = NULL;
   TMemoryStream *MS_NEW = NULL;
   try
   {
      try
      {
         MS_OLD = new TMemoryStream;
         MS_NEW = new TMemoryStream;

         MS_OLD->LoadFromFile( ExtractFilePath( ParamStr(0) ) + 
"file.txt" );
         for ( int i=0; i<MS_OLD->Size-1 ; i++ )
         {
            if (
                 (((char*)(MS_OLD->Memory))[i] == '\r') &&
                 (((char*)(MS_OLD->Memory))[i+1] == '\n')
               )
            {
               ++i;
            }
            else
            {
               MS_NEW->WriteBuffer( &((char*)(MS_OLD->Memory))[i] , 1 );
            }
         }
         MS_NEW->SaveToFile( ExtractFilePath( ParamStr(0) ) + "file2.txt" );
      }
      catch (  const Exception &e )
      {
         ShowMessage( "Error" );
      }
   }
   __finally
   {
      if ( MS_OLD )
         delete MS_OLD;
      if ( MS_NEW )
         delete MS_NEW;
   }
}


-- 
Best regards,
Vladimir Stefanovic 
Technical Details
Message-ID: <4288cbbc@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news4.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <42878a87$1@newsgroups.borland.com> <4287a0a4$1@newsgroups.borland.com> <4287a37a@newsgroups.borland.com> <428815f8@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,cb77108e6b3d9403
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Vladimir Stefanovic" <antivari@po.sbb.co.yu>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <42878a87$1@newsgroups.borland.com> <4287a0a4$1@newsgroups.borland.com> <4287a37a@newsgroups.borland.com> <428815f8@newsgroups.borland.com>
Subject: Re: memory stream parsing
Date: Mon, 16 May 2005 18:35:14 +0200
Lines: 52
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 82.117.212.65
Message-ID: <4288cbbc@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1116261308 82.117.212.65 (16 May 2005 09:35:08 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news4.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail