喜悦国际村 » JAVA/C/C++ » 来来来,大家讨论一下C++

页: [1]
游戏人间2008-3-28 08:08 AM
来来来,大家讨论一下C++

嘿嘿.C++Builder是我推荐的.

为什么不用VC的,我丫也不太清楚,可能是用VC的人太多的原因吧,我就不习惯一帮人都去玩某个东西,当玩PHP的人相当多的时候我就想再找一个新东西来学.而这个新东西绝对不能是主流东西,否则就没啥搞头了.

游戏人间2008-3-30 11:37 AM
[php]
//删除目录及下面所有文件夹,
void __fastcall TForm1::DirectoryRecursiveDelete(AnsiString        asPath)
{
  // struct        Stat statbuf;
  TSearchRec sr;
  int iAttributes;
  iAttributes =        faDirectory        | faAnyFile;

  //必须加 *.*,保证输入路径以\\结束
  if(FindFirst(asPath+"*.*",           iAttributes,                  sr)                ==                 0)
  {
                // stat(sr.Name.c_str(), &statbuf);
                if(sr.Attr == faDirectory && sr.Name !=        "."        && sr.Name != "..")        //不搜索.和..
                {
                        DirectoryRecursiveDelete(asPath+sr.Name+"\\");
                        RemoveDir(asPath+sr.Name+"\\");
                } else {
                        if(sr.Name != "." && sr.Name !=        "..")        DeleteFile(asPath+sr.Name);        // 不删除.和..
                }

                while(FindNext(sr)==0)
                {
                        // stat(sr.Name.c_str(), &statbuf);
                        if(sr.Attr == faDirectory && sr.Name !=        "."        && sr.Name != "..")        //不搜索.和..
                        {
                                DirectoryRecursiveDelete(asPath+sr.Name+"\\");
                                RemoveDir(asPath+sr.Name+"\\");
                        } else {
                                if(sr.Name!="." && sr.Name!="..") DeleteFile(asPath+sr.Name); //不删除.和..
                        }
                }
        }
        FindClose(sr);
        RemoveDir(asPath);
}

void __fastcall TForm1::Button1Click(TObject *Sender)
{
   DirectoryRecursiveDelete("C:\\ydlchina\\");
}

[/php]

日一下sadly,为什么我的\\\\\\\老被删除

[[i] 本帖最后由 游戏人间 于 2008-3-30 07:41 PM 编辑 [/i]]

游戏人间2008-3-30 12:01 PM
[php]


iFileHandle        = FileOpen("c:\\st.exe", fmOpenRead);

iFileLength        = FileSeek(iFileHandle,        0, 2);

FileSeek(iFileHandle, 0, 0);

pszBuffer        = new        char;

iBytesRead        = FileRead(iFileHandle,        pszBuffer, iFileLength);

FileClose(iFileHandle);

============================================================= 函数大全 =============================================================

1、字符串操作函数。

        字符串切割函数:strtok("字符串",        "切割关键字");                // 返回值:数组

2、系统函数.

        GetCurrentDir();                                                                        // 取得当前运行程序路径
        GetTickCount();                                                                                // 取得开机时间
        Close();                                                                                        // 关闭程序
        WinExec("D:\\千千静听\\TTPlayer.exe", SW_HIDE);                // 执行外部EXE文件


3、读写文本文件。

        // C++文本文件操作函数说明


        // 读出来
        TStringList        *TStringListP =        new        TStringList;                                                        // 创建对象
        TStringListP->LoadFromFile("D:\_mySoft\_configure\openExeFiles.txt");        // 得到数组
        String myString        = "";
        for        (int I;        I <        TStringListP->Count; I ++)        myString  += TStringListP->Strings[I] +        "\n";
        Memo1->Lines->Text = myString;
        delete TStringListP;

        // 写入
        TStringList        *TStringListP =        new        TStringList;                // 创建对象
        TStringListP->add("asodifjaskldf");                                        // 为TStringListP->Text数组添加一个值
        TStringListP->savetofile("d:\\user3.cfg");                        // 保存文件
        delete TStringListP;

============================================================= 组件用法 =============================================================

1、Memo组件的一些属性和方法。

        Memo1->Lines->LoadFromFile("文本文件的绝对路径");                // 装载
        Memo1->Lines->Clear();                                                                // 把Memo中的内容清掉
        Memo2->Text        = "当前时间:" +        TimeToStr(Time()) +        " 软件运行:" + myTime +        " 秒\r\n";


2、TcppWeb..载入网页内容:HTML->Navigate(WideString("http://phpx.com/happy").c_bstr());


[/php]

xieaotian2008-3-31 12:26 AM
那你学PYTHON吧,哈哈,我力推的,虽然国外流行,但是国内还是低谷时期呢.

游戏人间2008-3-31 12:41 AM
好像delphi就是它的变种,好像没什么好玩的.

isno2008-3-31 01:43 AM
为啥不用dev c++

xieaotian2008-3-31 06:39 AM
我热终于VC!

unspace2008-3-31 01:53 PM
我以后跟你混了

niohe2008-4-1 08:00 AM
我跟你们混了

font2008-4-1 12:56 PM
强烈推荐DEV C++

jdk_cn2008-4-2 10:25 AM
顶顶更健康!

多年Jsp空间运维经验, 高速Jsp空间服务专家 -- Java虚拟机 ([url]http://jvm.cn)[/url]


查看完整版本: 来来来,大家讨论一下C++


Powered by Discuz! Archiver 6.1.0  © 2001-2006 Comsenz Inc.
Processed in 0.006658 second(s), 2 queries