PRB: _dos_setftime() Fails to Set Date & Time for Network File

ID Number: Q68797

5.10 6.00 6.00a 6.00ax 7.00 | 5.10 6.00 6.00a

MS-DOS | OS/2

buglist5.10 buglist6.00 buglist6.00a buglist6.00ax buglist7.00

Summary:

SYMPTOMS

In Microsoft C versions 5.1, 6.0, 6.0a, 6.0ax, and C/C++ 7.0 the

_dos_setftime() function is used to set the date and time of a

file. If the file is on a local drive, the function behaves as

expected; however, if the file resides on a network drive, the date

and time returned by subsequent _dos_getftime() will not return the

new values.

The date and time of the file on the network will be set. However,

_dos_getftime() will not recognize the change until the file has

been closed and re-opened.

STATUS

Microsoft has confirmed this to be a problem in C versions 5.1,

6.0, 6.0a, 6.0ax, and C/C++ version 7.0, and QuickC versions 2.0,

2.01, 2.5, and 2.51 (buglist2.00, buglist2.01, buglist2.50, and

buglist2.51). We are researching this problem and will post new

information here as it becomes available.

More Information:

Sample Code

-----------

/* Compile options needed: none

*/

#include <stdio.h>

#include <dos.h>

#include <stdlib.h>

#include <fcntl.h>

void main(void)

{

int fh;

unsigned int new_date = 0x184f;/* 2/15/92 */

unsigned int new_time = 0x48e0;/* 9:07 AM */

unsigned int old_time, old_date;

if( _dos_open("test.dat", O_RDONLY, &fh) != 0)

exit(1);

_dos_getftime( fh, &old_date, &old_time );

system("dir test.dat");

_dos_setftime( fh, new_date, new_time );

system("dir test.dat");

_dos_close( fh );

if( _dos_open("test.dat", O_RDONLY, &fh) != 0)

exit(1);

printf("\nAfter closing and reopening the file.\n");

_dos_getftime( fh, &old_date, &old_time );

system("dir test.dat");

}

Additional reference words: 5.10 6.00 6.00a 6.00ax 7.00