Access is denied

Discussion in 'C Programming' started by TG Naveen, Jun 21, 2004.

  1. TG Naveen

    TG Naveen Guest

    i have created a file using low level functions.
    int Handle
    Handle = open ("c:\\windows\\calc_copy.exe" , _O_RDWR | _O_BINARY |
    _S_IREAD | _S_IWRITE ) ;

    close ( Handle );

    after the code compilation. when i tried to delete the file through
    dos box.
    its give message "Access is denied". how can i set attributes to a
    file when creating it or when closing it.
     
    TG Naveen, Jun 21, 2004
    #1
    1. Advertisements

  2. I suggest you use either the "system" command or use platform
    specific code. The platform specific code can be found in a
    platform specific newsgroup. See the FAQ link below.

    --
    Thomas Matthews

    C++ newsgroup welcome message:
    http://www.slack.net/~shiva/welcome.txt
    C++ Faq: http://www.parashift.com/c++-faq-lite
    C Faq: http://www.eskimo.com/~scs/c-faq/top.html
    alt.comp.lang.learn.c-c++ faq:
    http://www.raos.demon.uk/acllc-c++/faq.html
    Other sites:
    http://www.josuttis.com -- C++ STL Library book
     
    Thomas Matthews, Jun 21, 2004
    #2
    1. Advertisements

  3. TG Naveen

    CBFalconer Guest

    There are no such functions as "open()" or "close()" in standard
    C. You need to consult a group dealing with your particular
    operating system and/or compiler.

    Alternatively switch to documented functions such as fopen and
    fclose. The results will be portable, and you can ask questions
    about it here and/or read the FAQ.
     
    CBFalconer, Jun 22, 2004
    #3
  4. Just a quick note to say this link doesn't work, I tried .co.uk too which I
    believe is Demon's domain, but that didn't work either.
     
    Kieran Simkin, Jun 22, 2004
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.