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

删除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


相关文档:

C++中使用sqlite

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include ".\sqlite3_lib\sqlite3.h"
 
static int _callback_exec(void * notused,int argc, char ** argv, char ** aszColName)
{
    int i;
    for ( i=0; i<argc; i++ )
   ......

Delphi 与 C/C++ 数据类型对照表

Delphi 与 C/C++ 数据类型对照表
Delphi数据类型C/C++
ShorInt
8位有符号整数
char
Byte
8位无符号整数
BYTE,unsigned short
SmallInt
16位有符号整数
short
Word
16位无符号整数
unsigned short
Integer,LongInt
32位有符号整数
int,long
Cardinal,LongWord/DWORD
32位无符号整数
unsigned long
Int6 ......

C/C++编译器


和在IDE中编译相比,命令行模式编译速度更快,并可以避免被IDE产生的一些附加信息所干扰。本文将介绍微软C/C++编译器命令行模式设定和用法。
 
1、设置环境变量:
PATH=C:\Program Files\Microsoft Visual Studio 8\VC\bin
INCLUDE=C:\Program Files\Microsoft Visual Studio 8\VC\include
LIB=C:\Program File ......

linux 下用C实现‘CAT’的功能

linux
下用C实现‘CAT’的功能
#include<stdio.h>
int main(int argc,char *argv[]){
FILE *file;
char buf[1024],name[20];
int n;
if(argc != 2){
printf("wrong argument\n");
return 1;
}
file=fopen(argv[1],"r");
if(file==NULL){
printf("Cant't open!\n&quo ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号