[Issue 7659] New: Reopen a file

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 7 09:09:03 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7659

           Summary: Reopen a file
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bioinfornatics at gmail.com


--- Comment #0 from bioinfornatics <bioinfornatics at gmail.com> 2012-03-07 09:09:05 PST ---
Dear,
when you want to reopen a closed file from a File instance the programm
segfault, i.e above code

_________________________________
import std.stdio;
import std.string;

void main(){
    File f = File("text.txt", "w");
    f.writeln( "blah" );
    f.close();
    if( ! f.isOpen )
        f = File( f.name, "a+" );
    f.writeln( "blah" );
    f.close();
}
_________________________________


this tniny code segfault because when you close a file you can't after get the
filer name closed by using f.name

it will really helpfull to know at any moment the name from a File instance.
And method isOpen will get more sense to use. Because currently it said if
isopen or not but can't do many thing in more.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list