error with reading file name
    Ali Çehreli 
    acehreli at yahoo.com
       
    Thu Dec  6 22:59:34 PST 2012
    
    
  
On 12/06/2012 10:39 PM, ollie wrote:
 > On Thu, 06 Dec 2012 16:52:20 +0100, Suliman wrote:
 >
 >> I am trying to create simple app that would read user input and open
 >> file with such name, but every time when I run it's crash with error
 >>
 >> "std.file.FileException at std\file.d(294): \1.txt"
 >>
 >
 > After a call to readln, the string returned has termination characters
 > that need to be stripped off.
Good call.
 > 	string name = readln();
 >
 > 	while(name[$-1] == '\x0a' || name[$-1] == '\x0d')
 > 		name.length -= 1;
Or with std.string.chomp:
     string name = chomp(readln());
Ali
-- 
D Programming Language Tutorial: http://ddili.org/ders/d.en/index.html
    
    
More information about the Digitalmars-d-learn
mailing list