this is not the "right" way to do what you want to do...altough it seems to work, despite any possible problems with FreeCOM

DOS has its own, more elegant, API for file/directory listing...look for functions findfirst/findnext...they should be avaliable on your C compiler...

On 9/18/06, Marton <[EMAIL PROTECTED]> wrote:

Absolutely, the function is simple... just to see if two directories that
should have the same contents changed. Here it goes (hope it indents well):

int checkdir(void) {
    int i, filesize = 0;
    FILE *fp, *fp2;

    system("dir c:\\data\\base1 >c:\\data.dir");
    fp = fopen("c:\\data.dir","r");
    fp2 = fopen("c:\\dataorig.dir","r");
    fseek(fp, 0, SEEK_END);
    filesize = ftell(fp);
    fseek(fp2, 0, SEEK_END);
    if(filesize != ftell(fp2))
      filesize = -1;
    rewind(fp); rewind(fp2);

      int file1data = 0, file2data = 0;
      if(file1data != file2data)

    if(i != filesize)
      return 1;
      return 0;


This always returns 1 because the file data.dir gets cut so the compare with
dataorig.dir always fails.




"Let us change our traditional attitude to the construction of programs. Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do." (Donald Knuth)

"Yes, technogeeks can be funny, even if only to each other." (http://www.boogieonline.com/revolution/science/humor/)"

"Man is driven to create; I know I really love to create things. And while I'm not good at painting, drawing, or music, I can write software." (Yukihiro Matsumoto, a.k.a. ``Matz'')
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
Freedos-user mailing list

Reply via email to