473,804 Members | 3,049 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Display time for every file operation in c++

1 New Member
Hi,
I did a project in c++ to do file operations.The output of the program would be like this
File create\File1_1 created
File create\File1_1 Copied to copy\FileDest_1
File copy\FileDest_1 (6302 Bytes) Renamed to copy\File2_1 (6302 Bytes)
Files create\File1_1 and copy\File2_1 are equal
............... ..............

I would like to append time to the output. I tried to use the time function, it displays only the current time. I want to display the time for every single file operation. any sample code would be very helpful.

Thanks
Vchezel
Nov 10 '06 #1
1 2798
emp
32 New Member
include time.h and sys/timeb.h

char tsBuf[20];


time_t ltime;
struct tm *today;
time(&ltime);
today = localtime(&ltim e);

strftime(tsBuf, 18,"%D %T, today);


tsBut comes back populated with currentsystem date and time in the format
governed by the %D %T delimiters. you can concatenate the tsBuf to your output line.

For an explanation of more functionality of the delimeters go to

http://www.opengroup.o rg/onlinepubs/007908799/xsh/strftime.html
Nov 19 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
15195
by: Mark Depenbrock | last post by:
--Apple-Mail-2--68472726 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Can not make mysql connection - error log: 030708 08:53:48 mysqld started
1
2708
by: karanam ravi kiran via DotNetMonster.com | last post by:
hi friends, i am fresher in the world of .net, i have problem to display time in asp.net web continuously. i want to display time on the form like the "live timer on windows task bar" plz help me over this thing thank you ".net Monster" --
5
2102
by: japin0 | last post by:
This code below suppose to display time of my PC on the web but it doesnt ..it just echos "Hello W3Schools!" <html> <body bgcolor="yellow"> <center> <h2>Hello W3Schools!</h2> <p><%Response.Write(now())%></p> </center>
3
3902
by: jiayanxiang | last post by:
Is there any sample code to use Javascript to load and display a text file? It will be best if the user can select files using some kind of explorer. If that's complex, a text box to specify the file name will be fine as well. Once a text file is selected, I just need to display it in a text box. Thanks for the help.
11
3199
by: nickyeng | last post by:
I have a html file contains a form asking user to select a choice and press enter to pass the data to server. In server there, i have a cgi script(C language) that accepts the input from browser and then output a html page to browser. The browser should open the page, but it didn't, instead, it prompt me to save the file(.cgi file i requested in form method).... how that happens? i want to display the html file that the script output...
0
959
Flasharino
by: Flasharino | last post by:
I have an issue here at work. We have space on a network WAN server used for files shared among our team. Some WAN administration software - about which I have no details at this point - will archive (delete) any files which have not been accessed for some period of time. To restore the file some inconvenient, time-consuming procedure must then be carried out to have the file restored. My question is this - can some sort of XP batch file...
9
2077
by: tomhawkins1 | last post by:
Hi I currently have a site where users can upload files. These files can be doc, wmv, jpeg, xls, dwf, dwf and dwg. These files are uploaded to /home/**user**/uploads and not /home/ **user**/public_html/uploads to prevent any old user from browsing them. I then use a general showDoc page with the following function (from
3
2849
by: =?Utf-8?B?QmlsbHkgWmhhbmc=?= | last post by:
I have a asp.net app, in the page there is a scan activex which could scan and save a jpg file in client harddisk. How could we access and display this jpg file on the fly using js in the client IE? Thanks, -Billy zhang
21
5544
by: raagadeepthi | last post by:
Getting invalid file operation when using the below code. Iam running this on client machine and have created one director by name 'DEEPS' and have given read/write privileges ran the below quries for setting path. If i cannot run this porcedure on client machine. please help me for reading data from .txt file and updating into database with out using UTL packages. Please help create or replace procedure utl_file_test_read (
0
9572
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10562
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10303
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10070
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9132
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7608
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6845
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5508
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.