学习使用海湾合作委员会

发布于 2024-12-15 23:04:00 字数 240 浏览 4 评论 0原文

我是一名计算机科学专业的学生,​​出于我无法理解的原因,我只被教导在 TURBO 编译器中编写代码。

但现在我意识到我应该学习在 GCC 中编码。问题是我不知道任何头文件,因此我无法使用任何内置函数。

我见过的所有 GCC 教程都是针对初学者的。我处于更多的中间学习状态,因此如果你们中有人知道一本书或一个网站,我可以在其中了解有关头文件的详细信息,那么它将很有帮助。

注意:需要明确的是,我是一名 Linux 用户。

I am a student of computer science and for reasons beyond my comprehension i have only been taught to code in the TURBO compiler.

But now i have realized that i should learn to code in GCC. The problem is that i dont know any of the header files and therefore i am not able to use any of the built in functions.

All the GCC tutorials i have seen are for beginners. I am at more of an intermediate state of learning and hence if any of you know of a book or a website where i can learn the details about the header files then it would be helpful.

NOTE: just to be clear-i am a linux user.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

染火枫林 2024-12-22 23:04:00

gcc 使用的大多数头文件都符合 C C++ 或 POSIX 标准。因此你需要学习语言。 printf 位于每个符合标准的 C 编译器的 stdio.h 中。

有特定的 Linux 系统,但您可能不关心这些。如果您使用 Linux 系统,“man”命令是您的朋友 - 但它会告诉您头文件。

 man 3 printf

产生

NAME
   printf, fprintf, sprintf, snprintf, vprintf, vfprintf, vsprintf, vsnprintf - formatted output conversion

 SYNOPSIS
   #include <stdio.h>
 ....

Most of the header files used by gcc are either C C++ or POSIX compliant. Therefore you need to learn the language. printf is in stdio.h in every C compiler that is standards compliant.

There are specific linux ones but you probably dont care about those. If you ware using a linux system the 'man' command is your friend - but it tells you the header file.

 man 3 printf

produces

NAME
   printf, fprintf, sprintf, snprintf, vprintf, vfprintf, vsprintf, vsnprintf - formatted output conversion

 SYNOPSIS
   #include <stdio.h>
 ....
心在旅行 2024-12-22 23:04:00

就像如果你想使用 printf() (例如......),只需在 Linux 或 google 中的终端中输入 man printf (man 代表手册),你就会得到你想要的所有东西需要使用 printf:

Synopsis

#include <stdio.h>
int printf (const char *format, ...); 
int fprintf (FILE *stream, const char *format, ...); 
int sprintf (char *str, const char *format, ...); 
int snprintf (char *str, size_t size, const char *format, ...);

#include <stdarg.h>

int vprintf (const char *format, va_list ap); 
int vfprintf (FILE *stream, const char *format, va_list ap); 
int vsprintf (char *str, const char *format, va_list ap); 
int vsnprintf (char *str, size_t size, const char *format, va_list ap);

然后使用 printf(),你会发现你需要包含 stdio.h:

#include <stdio.h>

通常你可以在不包含它的情况下进行编译,但它会给你警告..

此外使用 <>包含标准头文件和“”包含您的标头,例如:#include“myHeaderinMyLocalFolder.h”

Like if you want to use printf() (for eg..), just type man printf (man stands for manual) in your terminal if Linux or in google and you'l get all the thing you need to use printf:

Synopsis

#include <stdio.h>
int printf (const char *format, ...); 
int fprintf (FILE *stream, const char *format, ...); 
int sprintf (char *str, const char *format, ...); 
int snprintf (char *str, size_t size, const char *format, ...);

#include <stdarg.h>

int vprintf (const char *format, va_list ap); 
int vfprintf (FILE *stream, const char *format, va_list ap); 
int vsprintf (char *str, const char *format, va_list ap); 
int vsnprintf (char *str, size_t size, const char *format, va_list ap);

Then to use printf(), you see that you need to include stdio.h:

#include <stdio.h>

Normally you can compile without including it but it gives you warning..

Moreover use <> to include standart header files and "" to include your headers like: #include "myHeaderinMyLocalFolder.h"

如果 TURBO-C (我猜你的意思是)类似于 TURBO-PASCAL,它有控制台函数库,那么标准 C 中就没有类似的东西。标准 C 是 gcc 使用的,所以如果你知道如何使用例如 stdio.h 中的函数没有太大区别。

If TURBO-C (which I guess you meant) is anything like TURBO-PASCAL, with it's library of console functions, there is nothing like that in standard C. And standard C is what is usedby gcc, so if you know how to use the functions in e.g. stdio.h then there is not much difference.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文