Hi.
I have an question:
Where do save attributes in file?
I opened file with hexeditor but which offset is for attributes in hex?
Hi.
I have an question:
Where do save attributes in file?
I opened file with hexeditor but which offset is for attributes in hex?
That depends, very much on file system and OS.
in windows
Use the following program for getting the file attributes using stat function.
Code:#include <stdio.h> #include <sys/stat.h> struct stat stResult; main() { if(stat("file.txt", &stResult) == 0) { printf("Filesize: %i\n", stResult.st_size); printf("Block size: %i\n",stResult.st_blksize); } else { printf("Couldn't get file attributes."); } }
File attributes are not stored in the file's data area no matter which OS. In some cases there is a file header which is normally invisible to the programmer. The file's name, attribute flags, timestamp and size are in the directory. Specific location information is in some linked list structure referenced from the directory entry as well.