Passing file handles from functions? (Changed since dmd v0.118)

BCS ao at pathlink.com
Wed Sep 17 17:51:43 PDT 2008


Reply to AEon,

> Last coding D 3.5 years ago. I wrote functions that would return the
> file handle. But such code no longer compiles under v1.030 (it worked
> under v0.118 though). Could someone please tell me how this may be
> fixed.
> 
> Compiler error:
> ---
> dmd -c -w -version=db_log -O -I. aepar.d
> aepar_file.d(706): Error: identifier 'File' is not defined
> aepar_file.d(706): Error: File is used as a type
> ---
> aepar.d:
> ---snip---
> File open_Read_Log( char[] logfile )    // Line 706
> {
> if( ! std.file.exists(logfile) )  exit(1);
> File lg = new File( logfile, FileMode.In );
> return lg;
> }
> ---snip---
> Function call from another function:
> ---snip---
> File lg = open_Read_Log( "filename" );
> ---snip---
> Thanks.
> 
> AEon
> 

One option (the first error makes me think it's not the case) is that there 
is another File in scope. Try "std.stream.File"




More information about the Digitalmars-d-learn mailing list