Access is denied

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • TG Naveen

    #1

    Access is denied

    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.
  • Thomas Matthews

    #2
    Re: Access is denied

    TG Naveen wrote:
    [color=blue]
    > 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.[/color]

    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:

    C++ Faq: http://www.parashift.com/c++-faq-lite
    C Faq: http://www.eskimo.com/~scs/c-faq/top.html
    alt.comp.lang.l earn.c-c++ faq:

    Other sites:
    http://www.josuttis.com -- C++ STL Library book

    Comment

    • CBFalconer

      #3
      Re: Access is denied

      TG Naveen wrote:[color=blue]
      >
      > 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.[/color]

      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.

      --
      Chuck F (cbfalconer@yah oo.com) (cbfalconer@wor ldnet.att.net)
      Available for consulting/temporary embedded and systems.
      <http://cbfalconer.home .att.net> USE worldnet address!


      Comment

      • Kieran Simkin

        #4
        Re: Access is denied

        "Thomas Matthews" <Thomas_Matthew sSpitsOnSpamBot s@sbcglobal.net > wrote in
        message news:RbDBc.3330 $jJ3.2270@newss vr32.news.prodi gy.com...[color=blue]
        > TG Naveen wrote:
        >[color=green]
        > > 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.[/color]
        >
        > 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.l earn.c-c++ faq:
        > http://www.raos.demon.uk/acllc-c++/faq.html[/color]

        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.
        [color=blue]
        > Other sites:
        > http://www.josuttis.com -- C++ STL Library book
        >[/color]


        Comment

        Working...