473,657 Members | 2,531 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 6517
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.li nux.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.l earn.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
4974
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 here or offline? thanks Tom
2
8736
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 current date/time. In order to be able to use them efficiently, we changed the current date/time on the QA database server to a specific date/time before starting the scripts, so we are sure the test scripts always run in the same environment.
1
9994
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, then how this can be done?.
10
2041
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 Saturday 9/11/04 should return Friday 9/10/04. I've tried getdate()-1 and getdate()-2 respectively but am getting stack overflow errors. Am I doing anything wrong, or is this just not possible?
0
1725
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 are as following
2
10328
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. variables only for calling process or session (in my case, the program will called in cmd.exe), but I need its global. There is no putenv on Windows, only _putenv and there is no _putenv on Linux (or I'm wrong?). I cann use of course something like...
4
6578
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 negative interval. Is T-SQL's GetDate() more accurate than that, or at least non-decreasing? Thanks,
6
6379
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 information is a timestamp of the program in datetime format, which has it's own clock.
27
3131
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 that's causing the problem. Here's how I wrote the program originally: #include <stdio.h> #include <string.h>
0
8420
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8324
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
8842
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...
0
8740
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6176
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
4173
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
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.