🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: FileCreate function problem

#14423
From: Paul
Date: Wed, 13 Aug 2003 14:02
17 lines
1631 bytes
The reason it's not working, is FileCreate returns the file handle. Then you
are trying to access it without relasing this handle. Try the following:

  if(!FileExists("c:\\CProjects\\test.txt"))
  {
    int i = FileCreate("c:\\CProjects\\test.txt");
    if( i != -1 )
    {
      FileClose( i );
      TStringList *Sample1 = new TStringList();
      Sample1->LoadFromFile("c:\\CProjects\\test.txt");
    }
  }

Hope this helps.

Paul.
Technical Details
Message-ID: <3f3a4507$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!news-out.visi.com!petbe.visi.com!proxad.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f3989ee@newsgroups.borland.com> <3f398d1f$1@newsgroups.borland.com> <3f398d79@newsgroups.borland.com> <3f39f7a6$1@newsgroups.borland.com> <3f3a1241@newsgroups.borland.com> <3f3a343e$1@newsgroups.borland.com> <3f3a3802@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,5967b7894a1d3380
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-08-13 07:10:34 PST
From: <Paul>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3f3989ee@newsgroups.borland.com> <3f398d1f$1@newsgroups.borland.com> <3f398d79@newsgroups.borland.com> <3f39f7a6$1@newsgroups.borland.com> <3f3a1241@newsgroups.borland.com> <3f3a343e$1@newsgroups.borland.com> <3f3a3802@newsgroups.borland.com>
Subject: Re: FileCreate function problem
Date: Wed, 13 Aug 2003 15:02:56 +0100
Lines: 19
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
x-mimeole: Produced By Microsoft MimeOLE V5.50.4807.1700
NNTP-Posting-Host: 20.138.254.2
Message-ID: <3f3a4507$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1060783367 20.138.254.2 (13 Aug 2003 07:02:47 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!news-out.visi.com!petbe.visi.com!proxad.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail