TIP: Click on subject to list as thread! ANSI
echo: cis.languages
to: ALL
from: Jon Beach 70004,1607
date: 1992-12-04 10:39:28
subject: #Structures in C-OS9 LII

#: 17210 S3/Languages
    04-Dec-92  10:39:28
Sb: #Structures in C-OS9 LII
Fm: Jon Beach 70004,1607
To: ALL

Greetings all.
I am a relatively new programmer in the C language and I have recently hit a
snag in a program that I am trying to write.  Ultimate purpose of the program
is to print out a nicely formatted monthly calender using a CoCo 3 and OS9
Level 2. 

I just tried to add code to the program that is supposed to extract the current
month and year from the system clock using the getime() function as defined in
the MicroWare and Carl Krieder C libraries for OS9 LII.

I am using the standard time.h file that defines the following structure:

struct sgtbuf {
        char   t_year,
                        t_month,
                        t_day,
                        t_hour,
                        t_minute,
                        t_second;
};

The section of code from my program is as follows:

#include 
.
.
.
main()
{
int month,year;
struct sgtbuf *timeinfo;

getime(timeinfo);

month = timeinfo.t_month;
year = timeinfo.t_year;

}

When compiled, this give "undeclared variable" and "struct member required"
errors for the timeinfo.t_month and timeinfo.t_year statements.
If I follow the example from the manual I have for the Krieder library and
declare timeinfo as follows:

        struct sgtbuf timeinfo;

I get the further error "cannot evaluate size".

Can any of you folks tell me what I am doing wrong and how to fix the problem. 
Like I say, I am relatively new to C and I have had no formal training in the
language.  Any assistance would be appreciated.  Thanks in advance.


There is 1 Reply.

SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.