hoe to set file attributes?

February 3, 2016 at 09:29:07
Specs: Windows 7, i3-2120 3.30 GHz / 4 GB
Hello,
I want to make a program in Dev C++ that will set or remove the file attribute (-s -h -r) with out know how file location (in C:\ Drive).
For example: I set to attribute +s +h the file test.txt. I know that is in C:\ but I don't know where...

*I have problem with the file attribute, that is the code:


int attr = GetFileAttributes("test.txt");

BOOL SetFileAttributeH(
"test.txt", // File Name.*
FILE_ATTRIBUTE_HIDDEN // File Attribute
);


*Second problem is how can I attribute the file without know where he is located..


See More: hoe to set file attributes?

Report •

#1
February 3, 2016 at 10:01:42
You cannot set the attributes without first determining the location of the file.

Report •

#2
February 4, 2016 at 21:38:38
and if I know the location, you know how to set attribute?

Report •

#3
February 4, 2016 at 23:52:44

Report •

Related Solutions

#4
February 5, 2016 at 05:36:07
I saw this a lot of times, but I don't understand how to write it so it will work for me...

Report •

#5
February 5, 2016 at 14:43:24
I can't explain it any better than Microsoft do in their documentation. They even give examples showing exactly how it is done.

Report •

#6
February 6, 2016 at 01:04:09
BOOL SetFileAttributeH(
"test.txt", // File Name.*
FILE_ATTRIBUTE_HIDDEN // File Attribute
);


This is the code ^
I have problem with the ending - ");"
Don't know why, if you know so I will be happy to get an answer..


Report •

#7
February 10, 2016 at 21:02:49
I found solution :)

Report •

Ask Question