1..time
機能:1970年1月1日0時から現在までの時刻を秒で返す。
参考書のプログラム(下のコード)を入力しコンパイラしたらエラーメッセージが出ました。
理由は全然わかりません。エラーメッセージを無視してa.outを作ってくれないんでしょうか?
とりあえず エラーを無視してa.outを作るかPATHを調べてみます。
ずばり答えを知っている方やヒントを持っている方は、ぜひぜひ教えてください。
Front pageでHP書いてますが表の罫線が表示されません・・・・
| code | error message |
| #include <time.h> #include <stdio.h> int main() { time_t = time(NULL); struct tm *tp = Loacaltime(&t); char *s = asctime(tp); printf("universal time : %ld\n", t); printf("local time : %s\n", s); return 0; } |
[koji@localhost
~/system_call]$ gcc time.c time.c: In function `main': time.c:6: parse error before `=' time.c:7: `t' undeclared (first use in this function) time.c:7: (Each undeclared identifier is reported only once time.c:7: for each function it appears in.) time.c:7: warning: initialization makes pointer from integer without a cast [koji@localhost ~/system_call]$ gcc time.c |
誤入力が原因でした。 参考書が正しかったです。今まで本のミスがたくさんあったので本を疑ってしまった。