Any dos programmers out there?

Hello, dont know if this belongs in the beginners fourms but here it goes anyway.

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.

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

[code]#include
#include

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];


read_structure(store);


list_names(store);

}
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
",store[lcv].ext[i]);
}
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:
");
}[/code]

Comments

  • Sorry, forgot to mention, im compiling with turbo c++ 3.0 in a windows 98 enviornment
  • : [code]: #include
    : if (absread(0, 14, [red]19 &readir[/red]) != 0)
    : printf("Error, cannot read drive a:
    ");
    : }[/code]:
    :
    The first thing that I notice it that there appears to be a missing comma after the third argument that is passed to [b]absread()[/b].

    I'm not familiar with [b]absread()[/b] and I've not been able to find it in my literature. What does it do and what are the arguments?

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!

Categories