Jump to content

File Attributes

- - - - -

  • Please log in to reply
5 replies to this topic

#1
hetra

hetra

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 297 posts
  • Location:Australia
  • Programming Language:C, C++, PHP, Python, Delphi/Object Pascal, Assembly
  • Learning:Python, Assembly
Hello all,

I wanted to know how to change the attributes or a file or directory using C++ (hidden, archive, read-only, etc.).

Thanks in advance.

#2
artificial

artificial

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 624 posts
What exactly do you want to know? If you're looking for the modes with which you can choose e.g. fopen()'s access to a file, look here. Or do you want to access files using ShellExecute()?

Greets,
artificial
Sometimes words ain't enough to express something. That's why computer scientists use double words.

#3
hetra

hetra

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 297 posts
  • Location:Australia
  • Programming Language:C, C++, PHP, Python, Delphi/Object Pascal, Assembly
  • Learning:Python, Assembly
I guess I wasn't clear enough. I want to change a file's (or a directory's) attributes (example to make it read-only or make it hidden, etc.) using C++.

#4
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
Through the WinAPI with SetFileAttributes()
SetFileAttributes Function (Windows)
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#5
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
What attributes exist for a file depend on the OS.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#6
hetra

hetra

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 297 posts
  • Location:Australia
  • Programming Language:C, C++, PHP, Python, Delphi/Object Pascal, Assembly
  • Learning:Python, Assembly
Thanks.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users