Thread overview
temp file
Feb 18, 2012
bioinfornatics
Feb 18, 2012
Denis Shelomovskij
Feb 18, 2012
bioinfornatics
Feb 18, 2012
HeiHon
February 18, 2012
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();

February 18, 2012
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
February 18, 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?

February 18, 2012
On Saturday, 18 February 2012 at 10:19:06 UTC, bioinfornatics wrote:
> 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 );
> }
...
> why i can not iterate over line?

You can, but the file is still open and you are at the end of the file.

Try:
     tmp.rewind;
     foreach( line; tmp.byLine() )
         writefln( "l: %s", line );