🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: FileCreate function problem

#14411
From: Paul
Date: Wed, 13 Aug 2003 08:32
58 lines
2684 bytes
Try removing the ! from the line
>> if(!FileCreate("c:\CProjects\test.txt")).

At present, the code tries to load from the file when the file does not
exist AND cannot be created:

if( file does not exist )
{
   if( file cannot be created )
   {
      Load from file.
   }
}

Paul.

"Martin C" <martinc@aol.com> wrote in message
news:3f398d79@newsgroups.borland.com...
> Sorry typing mistake, and yes I am using "c:\\CProjects\\test.txt"
>
>
> "Norm Jaffe" <mail@aurelsystems.com> wrote in message
> news:3f398d1f$1@newsgroups.borland.com...
> > Is this the exact code that you are using? If so, you'll need to
> "double-up"
> > each of the backslashes,
> > as "c:\\CProjects\\test.txt".
> >
> > Norm Jaffe
> > "Martin C" <martinc@aol.com> wrote in message
> > news:3f3989ee@newsgroups.borland.com...
> > > I am trying to create a file on runtime and start using it, using the
> > > following code..
> > >
> > >   if(!FileExists("c:\CProjects\test.txt"))
> > >   {
> > >      if(!FileCreate("c:\CProjects\test.txt"))
> > >     {
> > >          TStringList  *Sample1 = new TStringList();
> > >          Sample1->LoadFromFile("c:\CProjects\test.txt");   // Error
File
> > > does not exist...!!!
> > >     }
> > >   }
> > >
> > > please let me know what I am doing wrong here...and why the
LoadFromFile
> > > function fails although i am sure that the file is created...
> > >
> > > P.S. it might look wierd why I am loading an empty file content in a
> > > StringList, but I have my reasons for it...
> > > thanks..
> > >
> > >
> >
> >
>
>
Technical Details
Message-ID: <3f39f7a6$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-05!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.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>

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 01:40:10 PST
From: <Paul>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3f3989ee@newsgroups.borland.com> <3f398d1f$1@newsgroups.borland.com> <3f398d79@newsgroups.borland.com>
Subject: Re: FileCreate function problem
Date: Wed, 13 Aug 2003 09:32:47 +0100
Lines: 60
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: <3f39f7a6$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1060763558 20.138.254.2 (13 Aug 2003 01:32:38 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-05!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.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