Processing (BETA) version 135+ のリファレンスです。 旧バージョン使用者はソフトウェア内のリファレンスを参照してください。
この文書は Processing のAPIリファレンスを日本語に訳したものです。 最新の内容は 英語版 で確認して下さい。


Name

createWriter()

Examples
PrintWriter output;

void setup() {
  // Create a new file in the sketch directory
  output = createWriter("positions.txt"); 
}

void draw() {
  point(mouseX, mouseY);
  output.println(mouseX); // Write the coordinate to the file
}

void keyPressed() {
  output.flush(); // Writes the remaining data to the file
  output.close(); // Finishes the file
  exit(); // Stops the program
}
Description sketch フォルダに新しいファイルとそのファイルに書き込むための PrintWriter オブジェクトを作成します。 ファイルを正確に作成するためにはフラッシュを行わなければならない。 そのため flush()close() を使い処理を閉じる必要があります(上記の例を見てください)。

Processing リリース0134から、保存される全てのファイルはUTF-8でエンコードされます。 前回のリリースではプラットフォームに応じたデフォルトの文字コードを使用していましたが、 ファイルを他のプラットフォームに移動した場合に問題が発生する可能性がありました。
Syntax
createWriter(filename)
Parameters
filename Name of the file to be created
Usage Application
Related PrintWriter
createReader()
BufferedReader
Updated on May 24, 2007 06:11:18pm PDT

Creative Commons License

この文書の原文はクリエイティブ・コモンズ(Creative Commons)Attribution-Noncommercial-Share Alike(表示・非営利・継承) ライセンスで公開されています。 このライセンスは同一の許諾条件の下で原作者のクレジットを表示し、また作品を営利目的で利用しなければ、作品に対して複製、頒布、展示、実演、二次的著作物の作成が行えることを示します。

© 2007 Processing.org