473,503 Members | 11,968 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Linux - Getdate question and calling another program

Hi!

I look for a function like the Windows function getdate(&d); and
gettime(&t); to have the date and the time. Also I look for a function
like spawnl to call another program. These function should work with
Linux.

Can somebody help me?

Thanks a lot!

Yann
Nov 13 '05 #1
3 6503
On Sun, 02 Nov 2003 14:24:12 -0500, "Yann Laviolette"
<ya*************@gnome.org> wrote in comp.lang.c:
Hi!

I look for a function like the Windows function getdate(&d); and
gettime(&t); to have the date and the time. Also I look for a function
like spawnl to call another program. These function should work with
Linux.

Can somebody help me?

Thanks a lot!

Yann


Standard C, the topic here, provides the function time() prototyped in
<time.h> for getting the current system date and time. It also
provides the standard library function system() prototyped in
<stdlib.h> which may be able to launch external programs. Look them
up in your compiler's library documentation, man pages, or help files.

None of the functions you mentioned are part of standard C, so they
are all off-topic here. If you want Linux specific answers, ask in a
Linux programming group such as news:comp.os.linux.development.apps.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
Nov 13 '05 #2
Le Sun, 02 Nov 2003 21:27:54 +0000, Jack Klein a écrit*:

Thanks a lot Jack! You help me a lot! My problem is now solve.

Byebye!

Yann
Nov 13 '05 #3
Greetings.

In article <pa****************************@gnome.org>, Yann Laviolette
wrote:
I look for a function like the Windows function getdate(&d); and
gettime(&t); to have the date and the time.
Without more information on what exactly getdate() and gettime() are
supposed to do, I can only recommend the following:

#include <time.h>

time_t time(time_t *t);

(IIRC, even this isn't guaranteed to work, as C doesn't require that the
system have a clock.)
Also I look for a function
like spawnl to call another program.
"Call" in what way? The standard way is to use the system() function
defined in <stdlib.h>, though you may be looking for a POSIX-style fork()
exec(). The latter isn't standard C, but is widely supported on most Un*x
compilers, including those for Linux.
These function should work with Linux.


The above will work on Linux, or for that matter on any other system with a
conformant C compiler.

If you want something more specific to Linux, you'll have to ask in a
newsgroup catering to that platform. Try a gcc newsgroup.

--
_
_V.-o Tristan Miller [en,(fr,de,ia)] >< Space is limited
/ |`-' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= <> In a haiku, so it's hard
(7_\\ http://www.nothingisreal.com/ >< To finish what you
Nov 13 '05 #4

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

Similar topics

1
4969
by: Tom Jones | last post by:
I need to access databases on both win2k and Linux systems but I have to set up the DSNs under program control ... no uses using GUIs ... Has anyone done this? if so can we discuss it either in...
2
8725
by: Konstantin Zakharenko | last post by:
Hello, Our QA team have running a lot of test scripts (for automated regression testing), they run them on the different databases (Oracle/MS SQL). Several of those tests are dependent on the...
1
9990
by: manoj.bhosale | last post by:
Hello Friends, I am Manoj, just started learning c++ on linux. In 'C' or 'C++' program on DOS/Windows we use clrscr(); with #include<conio.h> file included. In linux conio.h file is not exist,...
10
2028
by: Bill Edwards | last post by:
I'm trying to produce an array of working days but want to force Saturday and Sunday to return the date of the previous Friday, e.g. Sunday 9/12/04 should return Friday 9/10/04 and similarly...
0
1714
by: szehau | last post by:
Hi all, I have a program written in C with embeded SQL. Following are the configuration: DB2/LINUX 8.1.5 Thread model: posix gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7) My problems...
2
10312
by: Andrej Litowka | last post by:
Hi All! If anybody know, how I cann set an enviroment variable (with ANSI C) on Windows similar like on Linux. I tried setenv, but the function doesn't work correct on Windows - it sets env....
4
6568
by: jim_geissman | last post by:
According to MS, GetLocalTime() (in C++) is only accurate to approx a second, even though it reports milliseconds, and calling it twice and computing the interval can on occasion lead to a...
6
6374
by: Matik | last post by:
Hi, I have a funny situation. Within: MSSQL 2000 SP3, everything below described is running on same PC. there is a program running, which sends information to two other programs. This...
27
3104
by: =?ISO-8859-1?Q?Tom=E1s_=D3_h=C9ilidhe?= | last post by:
I have a fully-portable C program (or at least I think I do). It works fine on Windows, but malfunctions on Linux. I suspect that there's something I don't know about the standard input stream...
0
7212
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
7296
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,...
1
7017
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...
0
7470
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...
1
5026
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...
0
3174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1524
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
405
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.