月度归档: 2010 年 5 月

  • sql server 2000 配置服务器失败 的解决办法

    把机子上所有防火墙,所有的杀毒软件,所有的安全工具…全部咔嚓掉.

    把先前装的SQL SERVER卸载掉,删除安装目录

    重装SQL SERVER

    OK..

  • C#读写文件

    C#读写文件的方法:

    C#中,在含有转义字符的 字符串前加@可以避免使用转义字符

    使用前要using System.IO;

    StreamReader reader = new StreamReader(@"E:/main.c", Encoding.Default);            
    string line;
    while ((line = reader.ReadLine()) != null)
    {
        Console.WriteLine(line);
    }
    reader.Close();
    // 参数改为false可以直接重写文件
    StreamWriter writer = new StreamWriter(@"E:/main.c", true, Encoding.Default);
    writer.WriteLine("ok..");
    writer.Close();

  • Windows下秒建大文件

    Windows下秒建大文件的方法:

    执行命令:F:/>fsutil file createnew wu 20480000000
    返回:已创建文件 F:/wu

    也可以使用API SetEndOfFile

  • warning:could not find /tmp. please create! 的错误解决

    Cygwin B20运行出现如下警告信息:

    bash.exe:warning:could not find /tmp. please create! 
    bash-2.05b$ 

    解决办法如下:

    到 cygwin 目录下(如果用cygnus,可能是cygnus/cygwin-b20目录)

    mkdir /tmp 
    chmod a+rwx /tmp 

    再打开Cygwin B20看看吧, 警告已经没有了.

  • C语言拆分字符串strtok

    C语言拆分字符串strtok函数

    Example
    /* STRTOK.C: In this program, a loop uses strtok
     * to print all the tokens (separated by commas
     * or blanks) in the string named "string".
     */
    #include <string.h>
    #include <stdio.h>
    char string[] = "A string/tof ,,tokens/nand some  more tokens";
    char seps[]   = " ,/t/n";
    char *token;
    void main( void )
    {
       printf( "%s/n/nTokens:/n", string );
       /* Establish string and get the first token: */
       token = strtok( string, seps );
       while( token != NULL )
       {
          /* While there are tokens in "string" */
          printf( " %s/n", token );
          /* Get next token: */
          token = strtok( NULL, seps );
       }
    }