RE: [Dev-C++] Time stamping an output file.
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Benjamin W. <ben...@ho...> - 2002-02-25 22:23:12
|
<html><div style='background-color:'><DIV>
<P>Thanks Gents (Ioannis & Jason). I appreciate the help on this one.</P>
<P>Have a good afternoon.</P></DIV>
<DIV></DIV>
<DIV><FONT face="Geneva, Arial, Sans-serif" size=2>Benjamin Wheeless</FONT></DIV>
<DIV></DIV>
<DIV><FONT face="Geneva, Arial, Sans-serif" size=2><STRONG>Network Systems - Delta Airlines, Inc.</STRONG></FONT></DIV>
<DIV></DIV>
<DIV><FONT face=Arial size=2><STRONG>Atlanta, GA - USA 30320</STRONG></FONT></DIV>
<DIV></DIV>
<DIV><FONT face=Arial size=2><STRONG>==============================</STRONG></FONT></DIV>
<DIV> </DIV>
<DIV></DIV>
<DIV></DIV>
<DIV></DIV>
<DIV></DIV>
<DIV></DIV>----Original Message Follows----
<DIV></DIV>From: "Ioannis Vranos" <NO...@YA...>
<DIV></DIV>To: "Dev-C++" <DEV...@LI...>
<DIV></DIV>Subject: RE: [Dev-C++] Time stamping an output file.
<DIV></DIV>Date: Mon, 25 Feb 2002 21:18:48 +0200
<DIV></DIV>
<DIV></DIV>I am sorry obviously i did not understand the question. I thought you
<DIV></DIV>wanted to manipulate the date/time stamp of the files, but you wanted to
<DIV></DIV>put a string to the filename. You can use the functions ctime() and
<DIV></DIV>time() of time.h in the style:
<DIV></DIV>
<DIV></DIV>
<DIV></DIV>#include <STDIO.H>
<DIV></DIV>#include <STDLIB.H>
<DIV></DIV>#include <STRING.H>
<DIV></DIV>#include <TIME.H>
<DIV></DIV>
<DIV></DIV>int main(void)
<DIV></DIV>{
<DIV></DIV>char filename[]="some filename - ";
<DIV></DIV>time_t tp=time(NULL);
<DIV></DIV>char *s=ctime(&tp);
<DIV></DIV>char *newname=malloc(strlen(filename)+strlen(s)+1);
<DIV></DIV>
<DIV></DIV>
<DIV></DIV>if(!newname)
<DIV></DIV>return EXIT_FAILURE;
<DIV></DIV>
<DIV></DIV>strcpy(newname, filename);
<DIV></DIV>strcat(newname, s);
<DIV></DIV>
<DIV></DIV>puts(newname);
<DIV></DIV>
<DIV></DIV>return 0;
<DIV></DIV>}
<DIV></DIV>
<DIV></DIV>
<DIV></DIV>
<DIV></DIV>Keep in mind that this operation is portable, that is it works
<DIV></DIV>everywhere.
<DIV></DIV>
<DIV></DIV>
<DIV></DIV>
<DIV></DIV>Ioannis
<DIV></DIV>
<DIV></DIV>* Ioannis Vranos
<DIV></DIV>* Programming pages:
<DIV></DIV>http://www.noicys.d2g.com
<DIV></DIV>* Alternative URL: http://run.to/noicys
<DIV></DIV>
<DIV></DIV>-----Original Message-----
<DIV></DIV>From: dev...@li...
<DIV></DIV>[mailto:dev...@li...] On Behalf Of Ioannis
<DIV></DIV>Vranos
<DIV></DIV>Sent: Monday, February 25, 2002 8:42 PM
<DIV></DIV>To: Dev-C++
<DIV></DIV>Subject: RE: [Dev-C++] Time stamping an output file.
<DIV></DIV>
<DIV></DIV>
<DIV></DIV>You can do it with win32 api:
<DIV></DIV>
<DIV></DIV>Syntax
<DIV></DIV>
<DIV></DIV>#include <IO.H>
<DIV></DIV>int getftime(int handle, struct ftime *ftimep);
<DIV></DIV>int setftime(int handle, struct ftime *ftimep);
<DIV></DIV>
<DIV></DIV>[ Useless things ]
<DIV></DIV>
<DIV></DIV></div><br clear=all><hr>Send and receive Hotmail on your mobile device: <a href='http://go.msn.com/bql/hmtag2_etl_EN.asp'>Click Here</a><br></html>
|