易截截图软件、单文件、免安装、纯绿色、仅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


相关文档:

安装ubuntu下的c和java开发环境基础库

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- ......

华为C/C++笔试题2

  华为C/C++笔试题2 收藏
1. 某32位系统下, C++程序,请计算sizeof 的值
#include <stdio.h>
#include <malloc.h>
void Foo ( char str[100] )
{
    printf("sizeof(str)=%d \n", sizeof(str) );//此处使用char *str与char str[100]是一样的,char str[100]不指明大小(char str[]) ......

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 ......

Python嵌入C++详解(1)

来CSDN的时候,刚刚接触Python,那时候对Python的嵌入部分很感兴趣,只是一直没有时间来弄清其面纱,因此也一直没有使用嵌入的功能,另一个原因是我还没有真正用Python写过一个正式的有用点的东西,不过,现在回过头来继续看这一部分,发现还是挺简单的。以前想把这部分翻译出来,可是由于时间原因,也没有那精力,所以这里 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号