Top > C

C言語標準関数一覧 Edit

http://cham.ne.jp/piro/p_stdfunc.html

逆引き Edit

文字列 Edit

大文字・小文字を区別せず文字列を比較する。 Edit

stricmp

※stricmpはC言語標準関数ではないが一般的に使える。

文字列を分割する(strtok) Edit

#include <stdio.h>
#include <string.h>

int main()
{
    char s[] = "*.asp; *.vbs  ;; *.xls ";
    char* s2;
    char* delim = " \t;"; 
    char* token; 

    // strtok は引数を書き換えてしまうので複製する
    s2 = strdup(s);

    token = strtok(s2, delim);
    while (token != NULL) {
        printf("[%s]\n", token);
        token = strtok(NULL, delim);
    }

    return 0;
}

結果

[*.asp]
[*.vbs]
[*.xls]

文字列を複製する(strdup) Edit

文字列を複製して返す。戻り値は呼び出し側が free() すること。

char* strdup(const char*)

※strdupはC言語標準関数ではないが一般的に使える。

日付 Edit

ファイル・ディレクトリ Edit

正規表現 Edit

その他 Edit

16進ダンプ Edit

#include <stdio.h>

void hexdump(char* ptr, int len)
{
    int i;
    for (i=0; i<len; i++) {
        if (i % 16 != 15)
            printf("%02X ", ptr[i]);
        else
            printf("%02X\n", ptr[i]);
    }
    if (i % 16 != 15)
        putc('\n', stdout);
}

int main()
{
    char* str = "hogehogemogemogepesopeso";
    hexdump(str, strlen(str));
    return 0;
}      

grep Edit



URL B I U SIZE Black Maroon Green Olive Navy Purple Teal Gray Silver Red Lime Yellow Blue Fuchsia Aqua White

Reload   New Lower page making Edit Freeze Diff Upload Copy Rename   Front page List of pages Search Recent changes Backup Referer   Help   RSS of recent changes
Last-modified: (220d)