Hello. Have already posted this on beginners board but just realised it probably belongs here, sorry bout that...

Im doing a module on the dos operating system for my collage.
For the project I have to list the deleted files on a floppy disk.
To do this I have been using the turbo c function absread() to read the root directory on the floppy.
The problem I am having is that the absread function seems start reading two bytes after the start of the sector, so for example if the first entry is named "example.txt" it shows up as "ample.txt" in the programme. This also messes up the time and date stamps etc.

Im compiling with turbo c++ 3.0 in windows 98.

My code is posted below, any help would be greatly appriciated...


typedef struct
char name[8]; /*Directory entry format for dos 6.0*/
char ext[3];
char attribute;
char res;
char createtimefine;
int createtime;
int createdate;
int lastaccessdate;
int eaindex;
int lastmodifytime;
int lastmodifydate;
int start_cluster;
long int size;
} dirstore;

void main(void);
void read_structure(dirstore *);
void list_names(dirstore []);

void main(void)
dirstore store[244];



void list_names(dirstore store[])
int lcv;
char key;
int i;

printf("File names in root dir are:


for (lcv = 0; lcv < 244; lcv++)
if (store[lcv].name[0] != 0x00)
for (i = 0; i < 8; i ++)
printf("Filename = %c
", store[lcv].name[i]);
for (i = 0; i < 3; i ++)
printf("Extension = %c
printf("Size = %d
", store[lcv].size);
printf("Press any key to continue
key = getch();

/* else printf("Unused directory entry

void read_structure(dirstore *readir)
if (absread(0, 14, 19 &readir) != 0)
printf("Error, cannot read drive a:


  • Never mind, got it working, just added one to the buffer in absread

    [code]absread(0, 14, 19, (&readir + 1));[/code]

    Thx anyway...
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion