user-0 提问: 请问下为什么引用了和 ，getdate()还是有错误，用vs2010写的

回复:
user: user-1
content: 引用 5 楼 q3733353520 的回复:[quote=引用 4 楼 alone857567508 的回复:] [quote=引用 3 楼 q3733353520 的回复:]  struct tm *getdate(const char *string);  The function getdate() converts a string representation of a  date  and        time,  contained in the buffer pointed to by string, into a broken-down        time.  The broken-down time is stored in a tm structure, and a  pointer        to  this  structure is returned as the function result.  This tm struc‐        ture is allocated in static storage, and consequently it will be  over‐        written by further calls to getdate().  RETURN VALUE        When successful, getdate() returns a pointer to a  struct  tm.   Other‐        wise,  it  returns NULL and sets the global variable getdate_err to one        of the error numbers shown below.  Changes to errno are unspecified.         On success getdate_r() returns 0; on error it returns one of the  error        numbers shown below. Program source        #define _GNU_SOURCE 500        #include <time.h>        #include <stdio.h>        #include <stdlib.h>         int        main(int argc, char *argv[])        {            struct tm *tmp;            int j;             for (j = 1; j < argc; j++) {                tmp = getdate(argv[j]);                 if (tmp == NULL) {                    printf("Call %d failed; getdate_err = %d\n", j, getdate_err);                    continue;                }                 printf("Call %d (\"%s\") succeeded:\n", j, argv[j]);                printf("    tm_sec   = %d\n", tmp->tm_sec);                printf("    tm_min   = %d\n", tmp->tm_min);                printf("    tm_hour  = %d\n", tmp->tm_hour);                printf("    tm_mday  = %d\n", tmp->tm_mday);                printf("    tm_mon   = %d\n", tmp->tm_mon);                printf("    tm_year  = %d\n", tmp->tm_year);                printf("    tm_wday  = %d\n", tmp->tm_wday);                printf("    tm_yday  = %d\n", tmp->tm_yday);                printf("    tm_isdst = %d\n", tmp->tm_isdst);            }             exit(EXIT_SUCCESS);        }               大哥，，这是啥意思。。。[/quote] 你说的getdata的用法[/quote]  额，错了，是getdate

user: user-1
content: 引用 4 楼 alone857567508 的回复:[quote=引用 3 楼 q3733353520 的回复:]  struct tm *getdate(const char *string);  The function getdate() converts a string representation of a  date  and        time,  contained in the buffer pointed to by string, into a broken-down        time.  The broken-down time is stored in a tm structure, and a  pointer        to  this  structure is returned as the function result.  This tm struc‐        ture is allocated in static storage, and consequently it will be  over‐        written by further calls to getdate().  RETURN VALUE        When successful, getdate() returns a pointer to a  struct  tm.   Other‐        wise,  it  returns NULL and sets the global variable getdate_err to one        of the error numbers shown below.  Changes to errno are unspecified.         On success getdate_r() returns 0; on error it returns one of the  error        numbers shown below. Program source        #define _GNU_SOURCE 500        #include <time.h>        #include <stdio.h>        #include <stdlib.h>         int        main(int argc, char *argv[])        {            struct tm *tmp;            int j;             for (j = 1; j < argc; j++) {                tmp = getdate(argv[j]);                 if (tmp == NULL) {                    printf("Call %d failed; getdate_err = %d\n", j, getdate_err);                    continue;                }                 printf("Call %d (\"%s\") succeeded:\n", j, argv[j]);                printf("    tm_sec   = %d\n", tmp->tm_sec);                printf("    tm_min   = %d\n", tmp->tm_min);                printf("    tm_hour  = %d\n", tmp->tm_hour);                printf("    tm_mday  = %d\n", tmp->tm_mday);                printf("    tm_mon   = %d\n", tmp->tm_mon);                printf("    tm_year  = %d\n", tmp->tm_year);                printf("    tm_wday  = %d\n", tmp->tm_wday);                printf("    tm_yday  = %d\n", tmp->tm_yday);                printf("    tm_isdst = %d\n", tmp->tm_isdst);            }             exit(EXIT_SUCCESS);        }               大哥，，这是啥意思。。。[/quote] 你说的getdata的用法

user: user-0
content: 引用 3 楼 q3733353520 的回复:struct tm *getdate(const char *string);  The function getdate() converts a string representation of a  date  and        time,  contained in the buffer pointed to by string, into a broken-down        time.  The broken-down time is stored in a tm structure, and a  pointer        to  this  structure is returned as the function result.  This tm struc‐        ture is allocated in static storage, and consequently it will be  over‐        written by further calls to getdate().  RETURN VALUE        When successful, getdate() returns a pointer to a  struct  tm.   Other‐        wise,  it  returns NULL and sets the global variable getdate_err to one        of the error numbers shown below.  Changes to errno are unspecified.         On success getdate_r() returns 0; on error it returns one of the  error        numbers shown below. Program source        #define _GNU_SOURCE 500        #include <time.h>        #include <stdio.h>        #include <stdlib.h>         int        main(int argc, char *argv[])        {            struct tm *tmp;            int j;             for (j = 1; j < argc; j++) {                tmp = getdate(argv[j]);                 if (tmp == NULL) {                    printf("Call %d failed; getdate_err = %d\n", j, getdate_err);                    continue;                }                 printf("Call %d (\"%s\") succeeded:\n", j, argv[j]);                printf("    tm_sec   = %d\n", tmp->tm_sec);                printf("    tm_min   = %d\n", tmp->tm_min);                printf("    tm_hour  = %d\n", tmp->tm_hour);                printf("    tm_mday  = %d\n", tmp->tm_mday);                printf("    tm_mon   = %d\n", tmp->tm_mon);                printf("    tm_year  = %d\n", tmp->tm_year);                printf("    tm_wday  = %d\n", tmp->tm_wday);                printf("    tm_yday  = %d\n", tmp->tm_yday);                printf("    tm_isdst = %d\n", tmp->tm_isdst);            }             exit(EXIT_SUCCESS);        }               大哥，，这是啥意思。。。

user: user-1
content: struct tm *getdate(const char *string);  The function getdate() converts a string representation of a  date  and        time,  contained in the buffer pointed to by string, into a broken-down        time.  The broken-down time is stored in a tm structure, and a  pointer        to  this  structure is returned as the function result.  This tm struc‐        ture is allocated in static storage, and consequently it will be  over‐        written by further calls to getdate().  RETURN VALUE        When successful, getdate() returns a pointer to a  struct  tm.   Other‐        wise,  it  returns NULL and sets the global variable getdate_err to one        of the error numbers shown below.  Changes to errno are unspecified.         On success getdate_r() returns 0; on error it returns one of the  error        numbers shown below. Program source        #define _GNU_SOURCE 500        #include <time.h>        #include <stdio.h>        #include <stdlib.h>         int        main(int argc, char *argv[])        {            struct tm *tmp;            int j;             for (j = 1; j < argc; j++) {                tmp = getdate(argv[j]);                 if (tmp == NULL) {                    printf("Call %d failed; getdate_err = %d\n", j, getdate_err);                    continue;                }                 printf("Call %d (\"%s\") succeeded:\n", j, argv[j]);                printf("    tm_sec   = %d\n", tmp->tm_sec);                printf("    tm_min   = %d\n", tmp->tm_min);                printf("    tm_hour  = %d\n", tmp->tm_hour);                printf("    tm_mday  = %d\n", tmp->tm_mday);                printf("    tm_mon   = %d\n", tmp->tm_mon);                printf("    tm_year  = %d\n", tmp->tm_year);                printf("    tm_wday  = %d\n", tmp->tm_wday);                printf("    tm_yday  = %d\n", tmp->tm_yday);                printf("    tm_isdst = %d\n", tmp->tm_isdst);            }             exit(EXIT_SUCCESS);        }

user: user-0
content: 引用 1 楼 q3733353520 的回复:不会出错    别人的写法应该是   typedef struct date {  }today; ，嗯，这个已经弄好了,那为什么引用了<time.h>和<dos.h>getdate()还是有错误

user: user-1
content: 不会出错    别人的写法应该是   typedef struct date {  }today;