text file access error

vb6 Nepal
  • 13 years ago

    hi all,

    I have made a software in VB6, which uses text files to store data.
    When the software is installed in computer having FAT file system it is having no problem accessing files. But when it is installed in computer with NTFS file system , it says File/Path access error though this runs smooth when user is Administrator.
    I am using this come Open "c:\data.txt" for Input as #1 'error here
    Please reply me if anyone has the solution for this.


    Thank you

  • 13 years ago
    Since the program is having problems opening a file right under c: for everyone but administrator I would first check permissions/security on the C drive for the users it is getting errors on.
  • 13 years ago

    Hi,

    Thank you for your reply.

    I want to set file permission from code. I want to grant read/write permission to all user group. How is that possible???
    Thank you

  • 13 years ago
    This sort of thing will require you to use the windows API.  If you havn't done this before I sudgest you read up on it first.  Also you will need to have some sort of API viewer.  I might be able to find you one if you need as the free one that I used, seems to be no-longer available.

    Other than that the only thing I can really do is to point you in the direction of MSDN "File Security and Access Rights".

    Hope this helps.





  • 13 years ago

    Someone has set up read/write permissions for a reason.

    They aren't there for you to simply change because it is inconvenient for your program.

    The correct thing to do is to make sure that files you need access to are stored in a location which all users of your program DO have access to.

    On a corporate network, that is commonly a network drive, mapped to a drive letter such as G: or X: or similar.

    In fact, surely that must be easier for you than digging around in API code and trying to circumvent the security?

    Alternatively, why not get the users to run your program with administrator credentials? (Right click, choose Run As... and enter the correct details.)

    That way, the security exists unchanged, but your program can do what it needs to do.

     

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“In order to understand recursion, one must first understand recursion.”