Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with FileOpen

111 views
Skip to first unread message

Iain

unread,
Nov 10, 2004, 9:52:39 AM11/10/04
to
I have a problem with a piece of code that works fine in our
office but does not work on the client site.

This is because the FileOpen function is returning -1, ie it
is unable, for some reason, to open a text file. I've been
able to recreate the error in our office by writing the text
file to a folder with no read permissions (using windows
security). All the security settings on the client site,
however, seem fine.

A prototype that I originally developed worked fine on the
client site. It is only when I've incorporated the code into
the main application that it fails.

Any suggestions would be gratefully received.

Brad Wery

unread,
Nov 10, 2004, 10:15:17 AM11/10/04
to
Hello Iain,

Do you verify that the file exists before opening it? Do you use the
full path while opening it? Try doing a FileExists on the exact file
that you want to open for extra validation.

Brad

Iain

unread,
Nov 10, 2004, 10:38:25 AM11/10/04
to
Hi Brad,

I'm already using FileExists. The file, which is created by
a seperate Java application, definitely exists. As I said,
the built app works in our own environment but not on the
client site. It's really a deployment issue, I think, rather
than a coding issue. I was just hoping tha someone else
might have had a similar problem in the past.

Thanks for the response.

Brad Wery

unread,
Nov 10, 2004, 10:44:36 AM11/10/04
to
Could the file be locked by another process?

Iain

unread,
Nov 10, 2004, 11:41:01 AM11/10/04
to
No, I'm certain there's no other process acting on the file.

Someone

unread,
Nov 10, 2004, 3:13:03 PM11/10/04
to
Permissions?

Iain suggested that:

Iain

unread,
Nov 11, 2004, 5:30:57 AM11/11/04
to
Yes, I'm pretty sure it's to do with permissions which would
explain why it works in our office but not on the client
site. In both cases the file is sitting on a box running
Windows 2000 with NTFS and Active Directory. In both cases,
however, full permissions have been granted to everyone. Is
there anything we've overlooked - in Active Dirctory maybe?

> , >>>>>ie it is unable, for some reason, to open a text

Brad Wery

unread,
Nov 12, 2004, 8:53:08 AM11/12/04
to
We had a problem with permissions on a file in one of our applications.
This is how we over came them:

//Local external function
Function boolean SetFileAttributesA (ref string filename, ulong attrib)
library "KERNEL32.DLL"

//Code to access file

String ls_file

ls_file = 'C:\somefile.txt'

SetFileAttributesA (ls_file, 0)

FileDelete(ls_prp)


I hope this solve it for your.

Brad

PB Dev

unread,
Nov 30, 2004, 6:11:15 PM11/30/04
to
you might also want to check the permission to the parent directories of the
directory where the file is existing. I remember we had this problem way
back.

hth

<Iain> wrote in message news:41933f61.290...@sybase.com...

prit...@yahoo.com

unread,
Jan 24, 2005, 8:38:16 AM1/24/05
to
I have faced similar problem where one of our clients had Novell
Network. I had to specify different parameter for fileopen instead of
LockReadWrite! used LockRead!. Check if you need to write to the file
otherwise use LockRead!. What you may want to do is develope a test
application which just opens file with different parameters. Run it at
client and see which setting works.

Pritam

0 new messages