-4

I have a task in which they give me the path to a file and I have to print all the attributes of that file...

So far all what I have found on the internet is about writing/reading from a file, but this does not help a bit.

EDIT: It has to be done in assembly language EDIT2: I'm using windows 7 x64, but all my programs are compiled using TASM, TLINK and I'm using Turbo Debugger for debuggin

Michael Petch
  • 46,082
  • 8
  • 107
  • 198
SnuKies
  • 1,578
  • 1
  • 16
  • 37
  • Why did you tag this with assembly? Do you have to implement a file system metadata reader? For which file system? What have you tried? – CodeCaster Dec 10 '16 at 18:21
  • I edited. I have to do this in assembly and all of they possible attributes. So far I've tried nothing, because it's the first time I use files in assembly. – SnuKies Dec 10 '16 at 18:24
  • 3
    What processor? What operating system? MS-DOS? Linux? OS/X? Other? 16-bit, 32-bit, 64-bit? – Michael Petch Dec 10 '16 at 18:27
  • So DOSBOX/TASM suggests you are likely writing 16-bit MS-DOS programs – Michael Petch Dec 10 '16 at 18:33
  • 1
    One of the Best DOS/BIOS resources is [Ralph Brown's Interrupt List](http://www.ctyme.com/rbrown.htm). In particular you'll be interested in [DOS Int 21h routines](http://www.ctyme.com/intr/int-21.htm) but specifically [Get File Attributes](http://www.ctyme.com/intr/rb-2802.htm) and the bit fields are defined [here](http://www.ctyme.com/intr/rb-2803.htm#Table1420) – Michael Petch Dec 10 '16 at 18:38
  • Michael Petch that's what I was looking for ! Thanks! Could you add it as an answer? – SnuKies Dec 10 '16 at 18:52

1 Answers1

3

Since this seems to be homework/assignment related I'm going to direct you to the resources and Interrupt information that you'll need to perform the task, without writing actual code.

  • One of the best places for all thing MS-DOS/BIOS related is Ralph Brown's Interrupt List
  • When dealing with DOS and Files most of the routines of interest will likely be the DOS Int 21h functions
  • In particular you'll probably want to use DOS's Int 21h/AX=4300h Get File Attributes function.

    AX = 4300h
    DS:DX -> ASCIZ filename
    
    Return:
    CF clear if successful
    CX = file attributes (see #01420)
    AX = CX (DR DOS 5.0)
    CF set on error
    AX = error code (01h,02h,03h,05h) (see #01680 at AH=59h)
    

    You will also find the file attribute bits

    Bit(s)  Description     (Table 01420)
    7      shareable (Novell NetWare)
           pending deleted files (Novell DOS, OpenDOS)
    6      unused
    5      archive
    4      directory
    3      volume label.
           Execute-only (Novell NetWare)
    2      system
    1      hidden
    0      read-only
    
Michael Petch
  • 46,082
  • 8
  • 107
  • 198