[Prévia] [Próxima] [Prévia por assunto] [Próxima por assunto]
[Índice cronológico] [Índice de assunto]

Re: Função nanosleep



Mario Marques Junior wrote:
        Ei, como se usa o nanosleep, se ele não aceita inteiro, nem string, só
ponteiro?
        Eu criei um struct timespec e tentei alterar o valor diretamente, mas
não deu certo. Só se eu não fiz direito...

#include <time.h>
....
int
main()
{
    ...
    struct timespec t = { 0, 10000 };  // sec, usec

    ...

    nanosleep(t, NULL);
}

Não sei se pode usar, mas no unistd.h tem a função usleep() que recebe um int,
indicando microssegundos para dormir...

[]'s
Wendel Scardua
----------------------------------------------------
Articuno - The Legend

6 Curses                                        = 1 Hexahex
8 Catfish                                       = 1 Octo-puss
10 to the minus 6th power Movie                 = 1 Microfilm
1000 pains                                      = 1 Megahertz
1 Word                                          = 1 Millipicture
10 to the 12th power microphones                = 1 Megaphone
10 to the 6th power Bicycles                    = 2 megacycles