Find the answer to your Linux question:
Results 1 to 6 of 6
Hi everybodypeeps! I'm trying to port a (what I thought was) relatively simple 250 line program from Windoze Console to Linux. However I have hit a few small snags - ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2004
    Posts
    3

    Help I'm trying to port Windoze C code!


    Hi everybodypeeps!

    I'm trying to port a (what I thought was) relatively simple 250 line program from Windoze Console to Linux.

    However I have hit a few small snags - the Windoze version uses GetPrivateProfileString (which I can cope with doing a little INI file reading function) and using _findfirst.

    Now I know glob can find files just as well as _findfirst can BUT what it doesn't do is tell you the last time_write which is crucial to the whole program.

    Is there a function in Linux that tells you the last time the file was written to? ( I REALLY don't want to fudge about with ls -l)

    Cheers

  2. #2
    Linux Guru fingal's Avatar
    Join Date
    Jul 2003
    Location
    Birmingham - UK
    Posts
    1,539
    I admit I don't really know the answer to that one, but would the 'touch' command be any use to you? It deals with time stamps on files, so perhaps there's a workaround in there somewhere.
    I am always doing that which I can not do, in order that I may learn how to do it. - Pablo Picasso

  3. #3
    Just Joined!
    Join Date
    Mar 2004
    Posts
    3
    Unfortunately no I need to know when a particular file was created not to change it.

    Thanks though - its along that track (if only it could return the time stamp instead of setting it!)

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru fingal's Avatar
    Join Date
    Jul 2003
    Location
    Birmingham - UK
    Posts
    1,539
    I wouldn't normally suggest this, and not sure if the forum moderators like it, but I would pm Dolda2000 (one of the moderators on this forum). He seems to know a lot about code and I am pretty sure he could give you an answer.
    I am always doing that which I can not do, in order that I may learn how to do it. - Pablo Picasso

  6. #5
    Linux Engineer big_k105's Avatar
    Join Date
    May 2003
    Location
    Fargo, ND
    Posts
    901
    i say keep it on the forums dolda2000 will be around sooner or later to read this post
    BIG K aka Kyle
    Programming Forums
    www.kylekonline.com
    Please don\'t PM me for help-- ask in the forums instead!

  7. #6
    Just Joined!
    Join Date
    Nov 2002
    Location
    USA
    Posts
    99
    The function
    Code:
    int stat(const char *file_name, struct stat *buf);
    will tell you all available file information. You will need to include the following headers:
    Code:
    #include <sys/stat.h>
    #include <unistd.h>
    Also, try the man pages for more information about the function.

Posting Permissions

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