Article View: borland.public.cppbuilder.nativeapi
Article #17757Re: local network problem
From: Hans Galema
Date: Tue, 04 Mar 2003 19:57
Date: Tue, 04 Mar 2003 19:57
42 lines
2199 bytes
2199 bytes
Paul Dadah wrote:
First was about to confirm what you said as when I tried your
code got the message 'Unable to open'.
Now I have no problems with the following code.
The Memo is always filled with the contents of the file.
void __fastcall TForm1::Button1Click(TObject *Sender)
{
AnsiString FileIn = "\\\\620ct\\c\\example.txt";
if(FileExists(FileIn))
{
int iFileHandle = FileOpen(FileIn, fmOpenRead);
if ( iFileHandle <= 0 )
ShowMessage("Unable to open:\n\n"+ FileIn);
else
FileClose(iFileHandle);
Memo1->Lines->LoadFromFile ( FileIn );
}
else
ShowMessage("File does not exist:\n\n"+ FileIn);
What you could try:
Omit the FileExists() and just do a
int iFileHandle = FileOpen(FileIn, fmOpenRead);
or a
Memo1->Lines->LoadFromFile ( FileIn );
> ..
> another question: when you connect to a computer that has a password (using
> network neighborhood ) you get a promt for the password and if you want to
> save the password. Is their an API function for this?
Sorry, don't know.
Hans.
Technical Details
Message-ID:
<3e650533$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!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3e640957@newsgroups.borland.com> <3e64619f@newsgroups.borland.com> <3e64eb3f$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,fd9439bf2e17e166 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-03-04 15:34:42 PST Date: Tue, 04 Mar 2003 20:57:54 +0100 From: Hans Galema <j.m.galema@maartens.nl> User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: local network problem References: <3e640957@newsgroups.borland.com> <3e64619f@newsgroups.borland.com> <3e64eb3f$1@newsgroups.borland.com> In-Reply-To: <3e64eb3f$1@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 129.125.108.11 Message-ID: <3e650533$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1046807859 129.125.108.11 (4 Mar 2003 11:57:39 -0800) Lines: 43 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail