Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
File 处理输出文件到哪里去了?_File_Save_Missing Data - Fatal编程技术网

File 处理输出文件到哪里去了?

File 处理输出文件到哪里去了?,file,save,missing-data,File,Save,Missing Data,我正在学习使用处理编程语言,并希望将数据保存在文件中。首先,为了得到它的感觉,我尝试了下面的代码,取自处理过程。它运行正常,但我找不到文件“positions.txt”的痕迹。拜托,出什么事了?我是在错误的地方寻找它,包括~/sketchbook,还是我犯了其他明显的错误 PrintWriter output; void setup() { // Create a new file in the sketch directory output = createWriter("posit

我正在学习使用处理编程语言,并希望将数据保存在文件中。首先,为了得到它的感觉,我尝试了下面的代码,取自处理过程。它运行正常,但我找不到文件“positions.txt”的痕迹。拜托,出什么事了?我是在错误的地方寻找它,包括
~/sketchbook
,还是我犯了其他明显的错误

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
}

我已在以下位置找到该文件:

/home/Harry/sketchbook/outputfiletest/positions.txt

我将程序保存为“outputfiletest”

“createWriter”的条目表示“在sketch文件夹中创建一个新文件,并向其写入一个PrintWriter对象”。实际上,它在sketchbook文件夹中为草图创建文件夹中的文件

在问之前应该看得更深一点,对不起

我现在已经解决了所有的问题,并且可以在我的主目录中打开一个文件,而不是默认的。其他问题只是我的编程错误