Article View: borland.public.cppbuilder.nativeapi
Article #14418Re: FileCreate function problem
From: Martin C
Date: Wed, 13 Aug 2003 09:09
Date: Wed, 13 Aug 2003 09:09
88 lines
3716 bytes
3716 bytes
the Exact Exception is (EFOpenError)
"Martin C" <martinc@aol.com> wrote in message
news:3f3a1241@newsgroups.borland.com...
> Hi Paul,
>
> I removed the (!) from the if (FileCreate("c:\\CProjects\\test.txt")) and
I
> still receive an exception 'Cannot open file "c:\CProjects\test.tct"' '
> ...although if I opened the CProjects directory from windows explorer I
can
> see the file has been created, and if I restarted the program and tried to
> use the code "LoadFromFile" Nothing happens and everything is ok, I
really
> don't know why this happens, does it takes some time before the program
can
> feel that the file has been created..!!!, or what I am doing wrong
> exactly...
>
> thanks...
>
> <Paul> wrote in message news:3f39f7a6$1@newsgroups.borland.com...
> > 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:
<3f3a12bf@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!ash.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3f3989ee@newsgroups.borland.com> <3f398d1f$1@newsgroups.borland.com> <3f398d79@newsgroups.borland.com> <3f39f7a6$1@newsgroups.borland.com> <3f3a1241@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 03:39:06 PST From: "Martin C" <martinc@aol.com> 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> Subject: Re: FileCreate function problem Date: Wed, 13 Aug 2003 01:09:05 -0800 Lines: 90 Organization: V Safe X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 62.135.27.112 Message-ID: <3f3a12bf@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1060770495 62.135.27.112 (13 Aug 2003 03:28:15 -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!ash.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail