Compartilhar via


_futime _futime32, _futime64

Define o time de modificação em um arquivo em aberto.

int _futime( 
   int fd,
   struct _utimbuf *filetime 
);
int _futime32( 
   int fd,
   struct __utimbuf32 *filetime 
);
int _futime64( 
   int fd,
   struct __utimbuf64 *filetime 
);

Parâmetros

  • fd
    Descritor de arquivo com o arquivo em aberto.

  • filetime
    Ponteiro para a estrutura que contém a nova data de modificação.

Valor de retorno

Retorne 0 se obtiver êxito.Se ocorrer um erro, o manipulador de parâmetro inválido é invocado, sistema autônomo descrito em Validação de parâmetro. Se a execução terá permissão para continuar, a função retornará – 1 e errno é conjunto para EBADF, indicando um descritor de arquivo inválido, ou EINVAL, indicando um parâmetro inválido.

Comentários

The _futime routine sets the modification date and the access time on the open file associated with fd*.* _futime is identical to _utime, except that its argument is the file descriptor of an open file, rather than the name of a file or a path to a file.The _utimbuf estrutura contém campos para a nova data de modificação e a time de acesso. Ambos os campos devem conter valores válido._utimbuf32 e _utimbuf64 são idênticos _utimbuf exceto para o uso de 32 bit e 64 bit time tipos, respectivamente. In Visual C++ 2005, _futime and _utimbuf** **use a 64-bit time type and _futime is identical in behavior to _futime64.Se você precisar forçar o comportamento antigo, definir _USE_32BIT_TIME_T. Isso faz com que _futime ser idênticos em comportamento para _futime32 e faz com que o _utimbuf estrutura para usar o tipo de time de 32 bit, tornando-o equivalente ao __utimbuf32.

_futime64, que usa o __utimbuf64 estruturar, pode ler e modificar arquivo datas até 23: 59: 59, 31 de dezembro de 3000, UTC; ao passo que uma telefonar para _futime32 falhará se a data em que o arquivo é posterior à 19: 14: 07 18 de janeiro de 2038, UTC. Meia-noite, 1 º de janeiro de 1970, é o limite inferior do intervalo de datas para essas funções.

Requisitos

Função

Cabeçalho necessário

Cabeçalho opcional

_futime

<sys/utime.h>

<errno.h>

_futime32

<sys/utime.h>

<errno.h>

_futime64

<sys/utime.h>

<errno.h>

Para obter mais informações de compatibilidade, consulte Compatibilidade na introdução.

Exemplo

// crt_futime.c
// This program uses _futime to set the
// file-modification time to the current time.
 
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <io.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/utime.h>
#include <share.h>

int main( void )
{
   int hFile;

   // Show file time before and after. 
   system( "dir crt_futime.c_input" );

   _sopen_s( &hFile, "crt_futime.c_input", _O_RDWR, _SH_DENYNO, 0 );

   if( _futime( hFile, NULL ) == -1 )
      perror( "_futime failed\n" );
   else
      printf( "File time modified\n" );

   _close (hFile);

   system( "dir crt_futime.c_input" );
}

Entrada: crt_futime.c_input

Arbitrary file contents.

Saída de exemplo

Volume in drive Z has no label.
 Volume Serial Number is 5C68-57C1

 Directory of Z:\crt

03/25/2004  10:40 AM                24 crt_futime.c_input
               1 File(s)             24 bytes
               0 Dir(s)  24,268,476,416 bytes free
 Volume in drive Z has no label.
 Volume Serial Number is 5C68-57C1

 Directory of Z:\crt

03/25/2004  10:41 AM                24 crt_futime.c_input
               1 File(s)             24 bytes
               0 Dir(s)  24,268,476,416 bytes free
File time modified

Equivalente do NET Framework

Consulte também

Referência

Gerenciamento de time