CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2002
    Posts
    7

    Usage of Utime() function -urgent

    pls give me an example of utime funtion to set the file modification time.
    when i used this with null parameter it does not change the file modification time to the current time


  2. #2
    Join Date
    Feb 2001
    Location
    Sydney, Australia
    Posts
    1,909

    Re: Usage of Utime() function -urgent

    From MSDN:


    /* UTIME.C: This program uses _utime to set the
    * file-modification time to the current time.
    */

    #include <stdio.h>
    #include <stdlib.h>
    #include <sys/types.h>
    #include <sys/utime.h>

    void main( void )
    {
    /* Show file time before and after. */
    system( "dir utime.c" );
    if( _utime( "utime.c", NULL ) == -1 )
    perror( "_utime failed\n" );
    else
    printf( "File time modified\n" );
    system( "dir utime.c" );
    }





    Output

    Volume in drive C is ALDONS
    Volume Serial Number is 0E17-1702

    Directory of C:\dolphin\crt\code

    05/03/94 10:00p 451 utime.c
    1 File(s) 451 bytes
    83,320,832 bytes free
    Volume in drive C is ALDONS
    Volume Serial Number is 0E17-1702

    Directory of C:\dolphin\crt\code

    05/03/94 10:00p 451 utime.c
    1 File(s) 451 bytes
    83,320,832 bytes free
    File time modified


    Please - rate answer if it helped you
    It gives me inspiration when I see myself in the top list =)

    Best regards,

    -----------
    Igor Soukhov (Brainbench/Tekmetrics ID:50759)
    [email protected] | ICQ:57404554 | http://soukhov.com

    Russian Software Developer Network http://rsdn.ru
    Best regards,
    Igor Sukhov

    www.sukhov.net

  3. #3
    Join Date
    Jan 2002
    Posts
    7

    Re: Usage of Utime() function -urgent

    Thanks a lot
    it helped me :-)


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured