-
C++
[C/C++] テーブルデータ(配列)をfor文で巡回する方法
テーブルデータを巡回して、ある要素のデータを検索する場面は多々あると思います。for文で配列の要素の先頭から終端までを巡回する方法について解説します。 要素数を宣言している場合 要素数を宣言する場合は、その要素数を#defineで定義してfor文で使用... -
C++
[C/C++] リスト構造体(チェーン構造)の書き方と使い方
構造体の配列を使いたいけど、要素数が未確定のため何回もreallocすることになって、処理が重たい。。。という場面に遭遇したことはありませんか?このような場合は、配列では無くリスト構造にするとreallocする必要がなくなり、要素の追加、削除、挿入の... -
C言語
[C言語 標準ライブラリ] ctype.hの使い方
ctype.hをインクルードすることで、文字を識別する関数群と大文字⇔小文字に変換する関数が使用可能になります。 関数 int isalnum(int c) 引数が英数字('A'~'Z'、'a'~'z'、'0'~'9')の場合に真、それ以外の場合に偽を返します。 使用例: #include <... -
C++
[C/C++] 二重インクルードによる型の再定義を防止する方法(インクルードガード)
プログラムの規模が大きくなってくると、ヘッダーがヘッダーをインクルードするような場面が発生してきます。このとき、複数のヘッダーをインクルードした場合に、型の再定義が発生してビルドエラーになる場合があります。このような場合を予め想定して、... -
Windows
[Windows] 絶対に覚えておきたいショートカットキー集
ショートカットキーを覚えておくと、作業が何倍も早くなりますので、是非覚えていってください。また、マウス操作が減るので人差し指の腱鞘炎も防ぐことができますよ。(笑)重要度に分けて、ご紹介します。 必須のショートカットキー ショートカットキー... -
C言語
[C言語 標準ライブラリ] assert.hの使い方
マクロ NDEBUG #include <assert.h>では定義されません。NDEBUGを定義すると、後述するassertマクロ関数を無効にすることができます。Visual Studioでは、リリースモードの場合にプリデファインとして定義されます。デバッグモードの場合は定義され... -
MIDI
[MIDI] ヘッダチャンク
ヘッダチャンクについて解説します。 ヘッダチャンクはMIDI(SMF)ファイルの先頭にあり、以下のようなデータ構造となっています。 バイトオフセットバイトサイズ内容04チャンクタイプ44ヘッダチャンクのサイズ82フォーマット102トラック数122ベース単位 チ... -
MIDI
[MIDI] ファイルフォーマットの概要
SMF (Standard MIDI File) のファイルフォーマットの概要について解説します。 SMFはチャンクと呼ばれるブロックで構成されています。チャンクにはヘッダチャンクとトラックチャンクの2つがあります。 また、フォーマット0/1/2の3パターンがあり、ほとんど... -
MIDI
[MIDI] MIDIファイルとは
SMF (Standard MIDI File)とは、演奏データを記録したファイルです。つまり、MIDIファイルに音源はありません。 MIDIファイルに対応した音楽プレーヤでMIDIを再生することができますが、その場合は音源にサウンドフォント等が使用されます。 Windowsだと、... -
ゲーム
あつまれ どうぶつの森 の自作マイデザイン
マイデザ#1 コッコ隊長 最初に作ったマイデザです。 マイデザ#2 まめきち&つぶきち 自作した中では一番人気。かわいい。 マイデザ#3 1ごう うちの島のエース。 マイデザ#4 ピカチュウ マイデザ#5 ワンピース海賊旗 マイデザ#6 もんぺ また気が向い...