Hard drive sector viewer

  • I am trying to make a small hard drive sector viewer and I am not familiar with -QT- Qt or GUI programming. I am wondering what is the most efficient way to read the sectors of the hard drive into my program and also how to display it in a QPlainTextEdit window.

    The following is what I have for reading the hard drive. I chose to do it in 4096 byte increments to try to cut down on how many times I have to read the hard drive. I am not sure at all if there is a better, more efficient way to do this:

    #include <QtGui/QApplication>
    #include "qct.h"

    int main(int argc, char *argv[])
    QApplication a(argc, argv);
    QCT w;

    QFile HDD;

    if (!HDD.open(QIODevice::ReadOnly))

    int BPL = 0; //for keeping track of how many bytes per line have been outputted
    int BPS = 0; //for keeping track of how many bytes per sector have been outputted
    int num = 0; //for counting how many sectors per 4096 bytes have been outputted
    double Sector = 0; //for keeping track of how many sectors have been outputted

    while (!HDD.atEnd())
    Bytes = HDD.read(4096);
    for(BPL=0;BPL<16;BPL++) //displaying 16 bytes per line

    out << "\n";

    return a.exec();

    I am trying to display 16 bits per line, in hex, with an assumed sector size of 512KB (not counting in advanced format disks, don't know how to poll the hard drive to see if it is AF or not, or how many sectors there are. If someone knows how to do that, please let me know). I don't know how to pass the information for display in the QPlainTextEdit window that I have.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.