473,395 Members | 1,466 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to print date created of a file in a C program?

365 100+
I have a file create 01/01/2011, I can see date wither with dir command on DOS or 'ls -l" command on LINUX, I want to print that date (creation) in C program, any idea?.
May 18 '11 #1
1 2448
Banfa
9,065 Expert Mod 8TB
The file system, and there fore the file times are platform specific and there is no platform independent way to get this information, i.e. you will need different solutions for Windows and Linux.

For Windows you can call a WIN32 API function like GetFileTime

for a Linux/POSIX system you could call int stat(const char *file_name, struct stat *buf);.

Your other alternative is to use a multi-platform library like Boost (expect one for C rather than C++ obviously).
May 19 '11 #2

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

Similar topics

0
by: Martin | last post by:
When I open MySQL Control Center, it shows "server properties" window when the server is selected on the left pane. One of the property is "date created". I have not found this variable in server...
21
by: Advocated | last post by:
Just been searching google, but havent come up with anything. Just wondering, whats the best way to print say a file.txt or other format to the screen? A link would be great and ill read up on it....
11
by: Dica | last post by:
i'm getting an error about 'the process cannot access the file becaise it is being used by another process.' write after i've created a new file and try to open it for writing with xmlTextWriter....
1
by: tony | last post by:
Is there a way to change the "print date" field in vb/vb.net code? I have a report that uses keywords like "MonthToDate" and "YearToDate" to genereate the report, I want to be able to change the...
3
by: C.K | last post by:
Hello all, I am still working on my calendar program, and I have decided that the best way is for my vb program to write html tags into a file and then to print the file from ie6. Everything is...
5
by: ComicCaper | last post by:
Hi all, I use a quiz program that accepts a text file for questions and answers in this format: Question Answer1 <----is the correct answer. Quiz randomizes answers. Answer2 Answer3...
11
by: A.M | last post by:
Hi, I found print much more flexible that write method. Can I use print instead of file.write method? Thank you,
7
by: Ron | last post by:
Hi All, Is it possible to have Access print a report, identical to one that would print to a printer, only print to a "standard" text file? I can't find it in help and when I try to just print...
1
by: RogerC1 | last post by:
I am developing a program in Access that lists files found in a folder and will print the chosen file. These files can be Word, PDF or Excel files. What is the syntax for printing an Excel file...
1
by: Ninja12 | last post by:
I created a program, and the input data gathered from the program is stored in a .dat file. There are three files. I want print the third file. My files are named (1), (2) (3). I use the Common...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.