🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
5 messages
5 total messages Started by Orlando Lopez Tue, 14 Mar 2006 17:30
FindFirst Open File Error
#4094
Author: Orlando Lopez
Date: Tue, 14 Mar 2006 17:30
30 lines
1644 bytes
Hi to all,

I have the following code:
//... some stuff
    if (FindFirst(this->wpath + "\\" + this->filefilter, iAttributes, sr) == 0)

    {
      do
      {
        if ((sr.Attr & iAttributes) == sr.Attr)
        {

          if (this->DebugLevel >= debug_level)
              ODebug_(this->LogName,
                      this->GetTimeStamp()+" [File Found] " + sr.Name);
          files->Add(sr.Name);
          TStream *file = new TFileStream(this->AppPath + sr.Name, fmOpenRead); // << I;m getting Open File error
          //this->InsertFile(sr.Name);
          //this->FileMove(sr.Name);
        }
      } while (FindNext(sr) == 0);
      FindClose(sr);
    }

While I'm getting a file open error when I try to open the file
using TFileStream?
FindFirst open the file?

Thanks in advance
Re: FindFirst Open File Error
#4095
Author: Orlando Lopez
Date: Tue, 14 Mar 2006 18:02
5 lines
933 bytes
Ok. Thanks for all, but I fixed.

>      FindClose(sr);
 I have to close every time that I do FindNext
Re: FindFirst Open File Error
#4097
Author: Remy Lebeau (TeamB)
Date: Wed, 15 Mar 2006 01:16
14 lines
1256 bytes
"Orlando Lopez" <hlopezrd@hotmail.com> wrote in message
news:44170bbb$1@newsgroups.borland.com...

>           TStream *file = new TFileStream(this->AppPath + sr.Name,
fmOpenRead); // << I;m getting Open File error

You are not specifying any sharing rights:

    TStream *file = new TFileStream(this->AppPath + sr.Name, fmOpenRead |
fmShareDenyWrite);


Gambit
Re: FindFirst Open File Error
#4102
Author: Orlando Lopez
Date: Wed, 15 Mar 2006 13:21
11 lines
1338 bytes
Hi Gambit,
>You are not specifying any sharing rights:
>
>    TStream *file = new TFileStream(this->AppPath + sr.Name, fmOpenRead |
>fmShareDenyWrite);
yes, but anyway, I only want to open the file using TClientDataSet
(there are XML files), but I was getting an EFOpen File error
using the TFileTream (using LoadFormFile). I could find that the FindFirst/FindNext
open the file with no shared.
I solved this using FindClose() after FindNext.
Re: FindFirst Open File Error
#4105
Author: Vladimir Grigoriev
Date: Thu, 16 Mar 2006 11:52
26 lines
1802 bytes
You need only one FindClose() for the given FindFirst() and all subsequent
FindNext().
The error that occurs in your code may be resulted from the proposoal that

this->wpath + "\\" + sr.Name

is not the same as

this->AppPath + sr.Name

Vladimir Grigoriev.

"Orlando Lopez" <hlopezrd@hotmail.com> wrote in message
news:441822d4$1@newsgroups.borland.com...
>
> Hi Gambit,
> >You are not specifying any sharing rights:
> >
> >    TStream *file = new TFileStream(this->AppPath + sr.Name, fmOpenRead |
> >fmShareDenyWrite);
> yes, but anyway, I only want to open the file using TClientDataSet
> (there are XML files), but I was getting an EFOpen File error
> using the TFileTream (using LoadFormFile). I could find that the
FindFirst/FindNext
> open the file with no shared.
> I solved this using FindClose() after FindNext.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads