| | |
'times' coding problem?
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Sep 2004
Posts: 2
Reputation:
Solved Threads: 0
Hi,
I confess I am stuck. Can anyone see a problem with the following code, to be run under Linux, compiled with g++ ?
#include <stdio.h>
#include <sys/types.h>
#include <sys/times.h>
int main () {
struct tms tmp;
times(&tmp);
printf("stime %d \n",tmp.tms_stime);
printf("utime %d \n",tmp.tms_utime);
return(0);
}
The code compiles and runs no problem.
I was expecting an output of a couple of large numbers that changed with time. Instead all I get it '0' and '1'.
I confess I am stuck. Can anyone see a problem with the following code, to be run under Linux, compiled with g++ ?
#include <stdio.h>
#include <sys/types.h>
#include <sys/times.h>
int main () {
struct tms tmp;
times(&tmp);
printf("stime %d \n",tmp.tms_stime);
printf("utime %d \n",tmp.tms_utime);
return(0);
}
The code compiles and runs no problem.
I was expecting an output of a couple of large numbers that changed with time. Instead all I get it '0' and '1'.
![]() |
Similar Threads
- problem with shares of printer (Windows NT / 2000 / XP)
- Applet won't load (Java)
- ASM Game Coding Problem/Question (Assembly)
- need help w/for loop (C++)
- Sony DRU-530A Problem in Windows XP (Windows NT / 2000 / XP)
- Windows XP or Bios Problem (Windows NT / 2000 / XP)
Other Threads in the C Forum
- Previous Thread: HEELLLPPPP!!!! Due Tomorrow 9-14-04
- Next Thread: Program to tell if Insert,Caps, Numlock, Alt, Ctrl, Leftshift & Rightshift is pressed
| Thread Tools | Search this Thread |
adobe ansi api array arrays asterisks binarysearch calculate centimeter char convert copyimagefile copypdffile cprogramme creafecopyofanytypeoffileinc createcopyoffile csyntax directory dynamic fflush file fork forloop frequency getlasterror givemetehcodez graphics gtkgcurlcompiling hacking hardware highest homework i/o inches incrementoperators infiniteloop initialization interest kernel km linked linkedlist linux linuxsegmentationfault list lists locate logical_drives match matrix microsoft motherboard multi mysql number open opendocumentformat opensource owf pattern pdf performance pointer pointers posix power problem probleminc program programming pyramidusingturboccodes radix read recursion recv repetition research scanf scheduling scripting segmentationfault send sequential shape socketprograming stack standard string strings structures systemcall testautomation turboc unix user variable voidmain() wab win32api windows.h





