删除C/C++注释
/********************************************************************
*删除C/C++注释
**********************************************************************/
#include <stdio.h>
//注意
//1.对/****/的处理
//2.要保留双引号之间的内容,如char* test = "/*i am not comment */";
//3.对于单引号中的内容同样保留(不检查程序的语法错误)
//4.对于转义字符的处理(见状态6),如char* test = "string\"string too/*i am not comment"
int noComment(FILE *in,FILE *out)
{
int ch, lastch, state = 0, sq = 0;
while( ( ch = fgetc(in) ) != EOF )
{
switch(state)
{
case 0:
if( ch == '/' )
{
lastch = '/' ;
state = 1 ;
}
else
{
if( ch == '\'' || ch == '"' )
{
state = 5 ;
if( ch == '\'' )
sq = 1;
}
fputc(ch, out);
&n
相关文档:
这篇文章是使用SQLite C/C++接口的一个概要介绍和入门指南。
由于早期的SQLite只支持5个C/C++接口,因而非常容易学习和使用,但是随着SQLite功能的增强,新的C/C++接口不断的增加进来,到现在有超过150个不同的API接口。这往往使初学者望而却步。幸运的是,大多数SQLite中的C/C++接口是专用的,因而很少被使用到。尽管有这 ......
1、安装基础类库和man帮助文档等
sudo apt-get install build-essential sun-java6-jdk debian-keyring g++-multilib g++-4.2-multilib gcc-4.2-doc libstdc++6-4.3-dbg equivs glibc-doc manpages-dev libstdc++6-4.3-doc diff-doc binfmt-support sun-java6-source manpages manpages-posix manpages-posix- ......
1. 找错
#define MAX_SRM 256
DSN get_SRM_no()
{
static int SRM_no;
int I;
for(I=0;I<MAX_SRM;I++,SRM_no++)
{
SRM_no %= MAX_SRM;
......
这个提法有点怪异,但还是常常出现:
char *p = "abcd";
和
string str = "abcdefg";
第一个叫做C风格的字符串,原因是有null作为结尾; 第二个为C++风格的, 不是以null结尾.
实质上: C风格的字符串是:
char[] pArr = {'a', 'b', 'c', 'd', '\0'};
这样决定了处理方式的不同 ......
linux 下 用c语言创建mysql数据库笔记(二)
-------两个简单的例子,供参考比较
《例一》
#include <stdio.h>
#include <stdlib.h>
#include
&q ......