There is a ongoing discussion about temp file over here:
http://forum.dlang.org/thread/sbehcxusxxibmpkae...@forum.dlang.org

I have a question about generating a temporary file to write test data. I can create my own file and use it but just want to use the existing tool for convenience. testFilename() is used all over phobos. So, I don't understand why it does not work on my code.

The following code fails to compile.


  % cat testFile.d
#!/usr/bin/env rdmd
import std.stdio;

unittest{

  static import std.file;
  auto deleteme = testFilename();
  scope(failure) printf("Failed test at line %d\n", __LINE__);

  scope(exit) std.file.remove(deleteme);

// Do some stuffs with open or writing and reading of the temp file.
   assert(true);



}
void main(string [] args){
  writeln("Main");

}

Reply via email to