| | |
'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 |
Tag cloud for C
adobe ansi api array arrays asterisks bash binarysearch calculate centimeter char convert copyanyfile copyimagefile copypdffile cprogramme createcopyoffile csyntax directory dynamic fflush file fork frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hacking hardware highest homework i/o inches incrementoperators infiniteloop initialization interest km lazy linked linkedlist linux linuxsegmentationfault list locate logical_drives match matrix meter microsoft motherboard multi mysql number open opendocumentformat opensource owf pattern pdf performance pointer pointers posix power problem probleminc program programming pyramidusingturboccodes read recursion recv repetition scanf scheduling scripting segmentationfault send shape socketprograming spoonfeeding stack standard string strings structures suggestions systemcall test testautomation unix user variable voidmain() wab win32api windows.h





