linux 编译运行c文件
在ubuntu安装gcc
编辑 test.c
/* Not stdio.h */
#include <unistd.h>
void main()
{
char str[100];
/*Write on screen*/
write(1,"\nType Something : ",17);
/*Read at most 100 chars from console into 'str' */
read(0,str,100);
write(1,"\nYou typed :\n",13);
/*write 10 chars from 'str' to screen */
write(1,str,10);
/*newline*/
write(1,"\n",1);
}
# gcc -o test test.c
完成后会出现一个可执行文件test,这就是编译好的文件,直接./test 就可以执行了!
收获不会与付出成反比
by juandx