Writing to file problem (Kernelbase exeption)

Konrad via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jun 5 13:39:41 PDT 2014


Right now I have:

import file = std.file;
import std.stdio;

int game_change_config(string _player_spritesheet, string 
_flame_spritesheet) {
    string info = _player_spritesheet~"\n"~_flame_spritesheet;
    char[] info_table;
    for(int i = 0; i < info.length; i++) {
       info_table.length++;
       info_table[info_table.length - 1] = info[i];
    }
    file.write("Data/config.ini", info_table);	
    return 0;
}

I'm changing my string into dynamic char array and I'm using 
"Data/config.ini" as a string, just as Stefan Koch suggested. 
Everything compiles and my function doesn't return any errors 
while working, but it's not changing my file content (it's still 
as same as before running a function).

Any solutions? I'm starting to get pretty angry about that 
problem (more complicated stuff is working fine and that one part 
can't)...

Best regards,
Ironus


More information about the Digitalmars-d-learn mailing list