Microsoft KB Archive/68797

{|
 * width="100%"|

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

 * }

Q68797

5.10 6.00 6.00a 6.00ax 7.00 | 5.10 6.00 6.00a | 1.00 1.50 MS-DOS | OS/2 | WINDOWS kbprg kbprb -- The information in this article applies to: - The C Run-time (CRT), included with: - Microsoft C for MS-DOS, versions 5.1, 6.0, 6.0a, and 6.0ax - Microsoft C for OS/2, versions 5.1, 6.0, and 6.0a - Microsoft C/C++ for MS-DOS, version 7.0 - Microsoft Visual C++ for Windows, versions 1.0 and 1.5 -- SYMPTOMS ======== 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 ====== The C run-time library is performing as expected. The problem is a limitation of either the operating system or the network software. MORE INFORMATION ================ Sample Code --- /* Compile options needed: none */ #include #include #include #include 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(&quot;test.dat&quot;, O_RDONLY, &fh) != 0) exit(1); _dos_getftime( fh, &old_date, &old_time ); system(&quot;dir test.dat&quot;); _dos_setftime( fh, new_date, new_time ); system(&quot;dir test.dat&quot;); _dos_close( fh ); if( _dos_open(&quot;test.dat&quot;, O_RDONLY, &fh) != 0) exit(1); printf(&quot;\nAfter closing and reopening the file.\n&quot;); _dos_getftime( fh, &old_date, &old_time ); system(&quot;dir test.dat&quot;); } Additional reference words: 5.10 6.00 6.00a 6.00ax 7.00 1.00 1.50 KBCategory: kbprg kbprb KBSubcategory: CRTIss

Keywords : kb16bitonly

Issue type :

Technology : kbVCsearch kbAudDeveloper kbCRT