易截截图软件、单文件、免安装、纯绿色、仅160KB

Linux系统下C语言编程基础知识介绍

这篇文章介绍在LINUX下进行C语言编程所需要的基础知识.在这篇文章当中,我们将会学到以下内容:  
源程序编译  
Makefile的编写  
程序库的链接  
程序的调试  
头文件和系统求助  
1.源程序的编译  
在Linux下面,如果要编译一个C语言源程序,我们要使用GNU的gcc编译器.   下面我们以一个实例来说明如何使用gcc编译器.  
假设我们有下面一个非常简单的源程序(hello.c):  
int   main(int   argc,char   **argv)
{
printf( " "Hello   Linux   " ");
}
 
要编译这个程序,我们只要在命令行下执行:  
gcc   -o   hello   hello.c  
gcc   编译器就会为我们生成一个hello的可执行文件.执行./hello就可以看到程序的输出结果了.命令行中   gcc表示我们是用gcc来编译我们的源程序,-o   选项表示我们要求编译器给我们输出的可执行文件名为hello   而hello.c是我们的源程序文件.  
gcc编译器有许多选项,一般来说我们只要知道其中的几个就够了.   -o选项我们已经知道了,表示我们要求输出的可执行文件名.   -c选项表示我们只要求编译器输出目标代码,而不必要输出可执行文件.   -g选项表示我们要求编译器在编译的时候提供我们以后对程序进行调试的信息.  
知道了这三个选项,我们就可以编译我们自己所写的简单的源程序了,如果你想要知道更多的选项,可以查看gcc的帮助文档,那里有着许多对其它选项的详细说明.  
2.Makefile的编写  
假设我们有下面这样的一个程序,源代码如下:  
/*   main.c   */
#include   " "mytool1.h " "
#include   " "mytool2.h " "
int   main(int   argc,char   **argv)
{
mytool1_print( " "hello " ");
mytool2_print( " "hello " ");
}
/*   mytool1.h   */
#ifndef   _MYTOOL_1_H
#define   _MYTOOL_1_H
void   mytool1_print(char   *print_str);
#endif
/*   mytool1.c   */
#include   " "mytool1.h " "
void   mytool1_print(char   *print_str)
{
printf( " "This   is   mytool1   print   %s   " ",print_str);
}
/*   mytool2.h   */


相关文档:

Installing PHP APC on GNU/Linux Centos 5

原贴:http://2bits.com/articles/installing-php-apc-gnulinux-centos-5.html
Published Mon, 2008/03/24 - 13:49, Updated Wed, 2009/07/15 - 23:40
Complex PHP applications, such as Drupal, can gain a lot of performance benefits from running a PHP op-code cache/accelerators
.
APC,
Alternate ......

Linux 平台下 MYSQL安装 启动 mysql命令

MYSQL安装
//解压编译安装
# tar xzvf mysql-5.0.27.tar.gz
# cd mysql-5.0.27
# ./configure -prefix=/home/redadmin/mysql
# make
# make install
# cd /home/redadmin/mysql/
# cp share/mysql/my-medium.cnf ./
# mv my-medium.cnf my.cnf
// my.conf文件修改
# vi my.cnf
修改前:
port  &nb ......

用Linux下Perl脚本连接SQLServer

准备工作:
  用到的perl 扩展组件(modules)在上篇贴出.( win32::odbc 模块
)下载组件后按照Readme文件安装倒响应目录.配置好相应的odbc数据源.
  
  程序实现:
  使用
  use
Win32::ODBC;
  
  语句包含应使用的模块是win32::odbc,写出数据库
连接字符串
  
  $DSN = "DSN =
My DSN ......

c/c++的知识点收集

1.动态获得内存的代码:
void GetMemory(char **p, int num)
{
  *p = (char *)malloc(sizeof(char) * num);
}
char* GetMemory2(int num)
{
  char* p = (char *)malloc(sizeof(char) * num);
  return p;
}
------------------------------------------
错误的代码:
void Ge ......

从函数返回一个数组的2种方法 (C专家编程 p230)

严格来说,无法从函数返回一个数组,但可以从函数返回一个指向任何数据结构的指针,包括一个指向数组的指针。
一种方式如下:
#include <stdio.h>
#include <stdlib.h>
int (*func())[20];//func是一个函数,它返回一个指向包括20个int元素的数组的指针
int main(void)
{
      ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号