Em qui., 17 de set. de 2020 às 14:37, Juan José Santamaría Flecha <
[email protected]> escreveu:
>
> On Thu, Sep 17, 2020 at 9:46 AM Michael Paquier <[email protected]>
> wrote:
>
>>
>> Could you send a rebase of the patch? Thanks!
>>
>
> Thanks for the reminder. Please find attached a rebased version.
>
Sorry, I'm missing something?
What's wrong with _stat64?
Pasta de C:\tmp
18/08/2020 16:51 6.427.512.517 macOS_Catalina.7z
1 arquivo(s) 6.427.512.517 bytes
0 pasta(s) 149.691.797.504 bytes disponíveis
C:\usr\src\tests\stat>crt_stat
File size : 6427512517
Drive : C:
Time modified : Tue Aug 18 16:51:47 2020
regards,
Ranier Vilela
// crt_stat.c
// This program uses the _stat function to
// report information about the file named crt_stat.c.
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <errno.h>
int main( void )
{
struct _stat64 buf;
int result;
char timebuf[26];
char* filename = "c:\\tmp\\macOS_Catalina.7z";
errno_t err;
// Get data associated with "crt_stat.c":
result = _stat64( filename, &buf );
// Check if statistics are valid:
if( result != 0 )
{
perror( "Problem getting information" );
switch (errno)
{
case ENOENT:
printf("File %s not found.\n", filename);
break;
case EINVAL:
printf("Invalid parameter to _stat.\n");
break;
default:
/* Should never be reached. */
printf("Unexpected error in _stat.\n");
}
}
else
{
// Output some of the statistics:
printf( "File size : %lld\n", buf.st_size );
printf( "Drive : %c:\n", buf.st_dev + 'A' );
err = ctime_s(timebuf, 26, &buf.st_mtime);
if (err)
{
printf("Invalid arguments to ctime_s.");
exit(1);
}
printf( "Time modified : %s", timebuf );
}
}