#: 7414 S3/Languages
16-Oct-90 11:48:54
Sb: #7323-c_problem
Fm: Pete Lyall 76703,4230
To: ANDY THIBODEAU 76636,2300
Andy -
Would have seen your message sooner had you included my PPN on it. Also, if
trying to send a listing (or other formatted text) that you don't want CIS's
editor to 'fix' for you, make sure that instead of just [s]aving it, you [s]ave
[u]nformatted.
A number of problems:
1. You are declaring variables after main() but before the 1st curly
brace. The only thing that should be in here is those parameters
that are going to be passed to main (like argv, argc, if used). You
should either have declared them ABOVE main (making them global to
all functions, or after the curly brace '{', making them locally
known to the 'main()' procedure only.
2. You are performing an atoi() function on something that's not ASCII
to begin with (atoi converts ASCII to its INTEGER equivalent).
3. Your printf() statement had no terminating quote, and contained
an unusual formatting list (i.e. "u%u ... or something close).
Try something along these lines:
#include
#include
main(argc,argv) /* args optional here */
{
int ti; /* a place to stuff 'minutes' */
struct sgtbug timejunk;/* a place to hold the time */
getime(&timejunk); /* tell the system to go get it */
ti = timejunk.t_minutes; /* go get a copy of the minutes */
printf("The number of minutes is: %d\n", ti);
}
NOTE: I'm just scratch typing at work, and haven't compiled this under os9.
Also, you could omit the 'ti' stuff and just:
printf("The number of minutes is: %d\n", timejunk.t_minutes);
Pete
|