473,386 Members | 1,973 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,386 software developers and data experts.

About using ctime

I am try ing to use ctime with the type time_t ,

I used
....

time_t t = time(0);
char* sc = ctime( &t);
printf ("%s\n", sc);

....

it crashes for 64 bit compilations but does file with gcc -m32,

Is there a any fix to this problem, I am searching for a 64 bit
compatible definition for ctime , is it available by default
Oct 7 '08 #1
1 4112
pa********@hotmail.com said:
I am try ing to use ctime with the type time_t ,

I used
...

time_t t = time(0);
char* sc = ctime( &t);
printf ("%s\n", sc);

...

it crashes for 64 bit compilations but does file with gcc -m32,

Is there a any fix to this problem, I am searching for a 64 bit
compatible definition for ctime , is it available by default
Assuming you have #included <stdio.hand <time.h>, there is nothing wrong
with the code you have shown. Therefore, either you failed to include one
or other (or both) of those headers, or the problem lies elsewhere in your
code, or you have a broken compiler. My bet is on Option 2.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Oct 7 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: bill ramsay | last post by:
Dear all. I am using an existing hodge-podge of an application that runs on top of an Access database. This application dials up customer equipment, handshakes then downloads/uploads various...
1
by: | last post by:
Hi I am using SQL server 7.0 and here is my code: Dim conn set conn = Server.CreateObject("ADODB.Connection") conn.open "websql" If conn.state=adStateOpen then Response.Write("ConnMade :...
1
by: Tivo Escobar | last post by:
Hi all, anybody here can tell me what exactly is returned by the standard function time() in <ctime> (or time.h). Please dont tell me it is the number of seconds since 1 Jan of 1970 GMT, cos it...
5
by: berkay | last post by:
long num,num1; char *first; char *last; num=ilk.getTime();//gets time first=ctime(&num); cout.flush(); fflush(stdin); 1) cout<<"first:"<<first;
16
by: John Hanley | last post by:
I created a function that breaks down a date into broken down time, I subtract a certain number of seconds from that, then use mktime() to recompute the calendar time. It works basically except...
2
by: Chris | last post by:
Hello, How can i convert a C++ CTime (4 bytes) into a C# DateTime ? (my CTime is read in a file). Thanks, -- Chris
11
by: aisling.cronin | last post by:
Hi I am using ctime to convert the following string 1144412677847 .... Please could some one to double check if they get the same result as me (The Time is Sun Nov 02 09:11:51 2031). It seems...
4
by: Pietro Cerutti | last post by:
Hi group, #include <stdio.h> #include <unistd.h> #include <time.h> int main(void) { time_t t1, t2; char *st1, *st2;
5
by: progstuff | last post by:
How do I use the library ctime to set the current time in: seconds, hours (24 hour), minutes into separate integers. And how do i do the same thing with dates setting the current year, day ,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.