#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    1
    Rep Power
    0

    Create Network Drive File


    Express 2010

    I author a C DLL that supports a VB app. My C DLL gets a string & file path from the VB app, it then writes the string to the file - simple enough.

    My DLL fails when the folder is on the network drive (Ex: File from VB \\\\FR010A\\uidu8973$O$\\FCom\\F\\Key.bin). Note that the VB app uses Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) to get the path of My Docs.

    I wish to solve this - any suggestions?

    code:
    //write file
    if ( ! fopen_s(&fs,f,"wb") )
    {
    fprintf(fs,"%s",String);
    fflush(fs);
    fclose(fs);
    success = true;
    }
    else
    {
    PrintDebug("fopen_s() failed!\n");
    }
  2. #2
  3. I'm Baaaaaaack!
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Jul 2003
    Location
    Maryland
    Posts
    5,538
    Rep Power
    243
    When you try to access the same location manually what happens? Perhaps that location is read-only. You should be able to print the specific error when your fopen fails.

    My blog, The Fount of Useless Information http://sol-biotech.com/wordpress/
    Free code: http://sol-biotech.com/code/.
    Secure Programming: http://sol-biotech.com/code/SecProgFAQ.html.
    Performance Programming: http://sol-biotech.com/code/PerformanceProgramming.html.
    LinkedIn Profile: http://www.linkedin.com/in/keithoxenrider

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw

IMN logo majestic logo threadwatch logo seochat tools logo