Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Rewrite

bubblybubbly Member Posts: 18
I have...

SaveTablePopulationDialog.Execute;
AssignFile(SavePopulate, SaveTablePopulationDialog.FileName);
Rewrite(SavePopulate);


If the file doesn't exist, it's creating it and writing to it.
However, if I want to overwrite it, it crashing the program on me.

I though Rewrite created the file if it didn't exist, and if it does, then it overwrites whats in it?


Comments

  • zibadianzibadian Member Posts: 6,349
    : I have...
    :
    : SaveTablePopulationDialog.Execute;
    : AssignFile(SavePopulate, SaveTablePopulationDialog.FileName);
    : Rewrite(SavePopulate);
    :
    :
    : If the file doesn't exist, it's creating it and writing to it.
    : However, if I want to overwrite it, it crashing the program on me.
    :
    : I though Rewrite created the file if it didn't exist, and if it does, then it overwrites whats in it?
    :
    :
    Normally Rewrite() overwrites an existsing file, as long as it can write to that file. If the file is opened by another process, it cannot write to it, and thus raises an exception. If writing to an existing file, be sure that it is available for writing.
Sign In or Register to comment.