First a big hello to all you assembly people! :lol: It's nice to be here, I would like to get to know you guys.

I am trying to self-teach myself computer architecture and assembly. I just finished Number Systems chapter, I was curious on the Odometer, although I understood what was going on there. I wanted to run the code.

First I found it weird that text with a tab inside the code box has numbering so I went ahead and deleted that in the code, probably a bug in the web site, and Sleep as far as I found out is a function for Windows, there says you can use the code even in Unix systems, compiling it with GCC.

Also I deleted all the stuff from /* choose platform */ to endif

I just thought I would try to do this the way I would do it. Code compiled, tried to run it but finished too fast, then I tried playing with the Sleep parameter number and discovered it is in milliseconds.

#include <stdio.h>
#include <windows.h>

int main()
 register int i = 0;

 for (i = 9985; i <= 10000; ++i)
     /* display a number */
     printf ("%05d\r", i);
     fflush (stdout);

     /* Sleep for 1/10 second */

 return 0;

This works, but in Windows, I would like to know how to do the same but for Unix. Considering windows.h header is included in DevC++, it is like now it is some standard thing in Windows but wouldn't be cross platform.

This part of the forum seems really inactive, btw. But surely the book will be helpful anyway. :)

Posted on 2009-07-08 21:21:09 by Lyusex
There's a similar sleep function in Unix.  ;)

#include <unistd.h>
Posted on 2009-07-08 21:58:02 by roticv

There's a similar sleep function in Unix.  ;)

#include <unistd.h>

Thank you Victor. :) I really appreciate you responded fast.
Posted on 2009-07-09 00:13:34 by Lyusex