temp file

bioinfornatics bioinfornatics at fedoraproject.org
Sat Feb 18 02:19:04 PST 2012


Le samedi 18 février 2012 à 12:58 +0400, Denis Shelomovskij a écrit :
> 18.02.2012 6:59, bioinfornatics пишет:
> > hi,
> > when i try to use tmpfile from std.stdio i get this error
> >> char 0x00ad not allowed in identifier
> >
> > I use dmdfe 2.058, i do just:
> > File tmp = tmpfile();
> >
> 
> Full source, please. And you should use `File.tmpfile()` instead of 
> `tmpfile()` (unless you are already in `with(File)`?). This compiles:
> ---
> import std.stdio;
> 
> void main() {
>      with(File) File tmp = tmpfile();
> }
> ---
> 
> Anyway, 0x00ad is 'SOFT HYPHEN' (not a '_' char) and is valid but 
> ignorable in a Java identifier. Looks like your editor added it.
> http://www.fileformat.info/info/unicode/char/ad/index.htm
> 
> By the way, you just inspired me to fill this:
> http://d.puremagic.com/issues/show_bug.cgi?id=7537

thanks is was mine stupid error.

Then now i have this:
--------------------------
cat tmp.d
import std.string;
import std.stdio;

void main(  ){
    File tmp = File.tmpfile();
    tmp.writeln( "ok" );
    tmp.writeln( "D is Fun" );
    writefln( "fileName: %s", tmp.name );
    foreach( line; tmp.byLine() )
        writefln( "l: %s", line );
}

--------------------------
$ ./tmp
fileName: 
--------------------------

Why i do not get the file name ?
why i can not iterate over line?



More information about the Digitalmars-d-learn mailing list