Access is denied

T

TG Naveen

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.
 
T

Thomas Matthews

TG said:
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.

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
 
C

CBFalconer

TG said:
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.

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.
 
K

Kieran Simkin

Thomas Matthews said:
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

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.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top