Writing to file problem (Kernelbase exeption)

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jun 5 13:50:38 PDT 2014


On 06/05/2014 01:39 PM, Konrad wrote:> 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];

That is not necessary, a simple concatenation would be the equivalent:

     info_table ~= info[i];    // instead of the previous two lines

 >     }
 >     file.write("Data/config.ini", info_table);

Random guess: Try with full path and see whether that helps. How about 
file access rights? Can you write to that file by other means?

Ali



More information about the Digitalmars-d-learn mailing list