/proc/のエンコーディング/ cmdlineファイル

/proc/のエンコーディング/ cmdlineファイル

このファイルを使用しようとしていますが、/proc/<pid>/cmdlineファイルエンコードに関するドキュメントが見つかりませんでした。私が見つけることができる唯一の情報はマニュアルページにあります。

 /proc/[pid]/cmdline
    This holds the complete command line for the process, unless the process is a zombie.  In the  latter
    case, there is nothing in this file: that is, a read on this file will return 0 characters.  The com‐
    mand-line arguments appear in this file as a set of strings separated by null bytes  ('\0'),  with  a
    further null byte after the last string.

cmdlineファイルのエンコーディングは何ですか?

ベストアンサー1

コマンドライン引数は、このファイルにヌルバイト( '\ 0')で区切られた文字列のセットで表され、最後の文字列の後にはヌルバイトが続きます。

それはあなたが必要とするすべてです。ヌルバイトで区切られたコマンドとその引数を取得しました\0。文字のエンコーディングはに基づいていますlocaleが、これは重要ではありません。

助けが必要な具体的な例はありますか?

おすすめ記事