mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 20:21:26 +00:00
- use FileWriter for 'writemidi' CCMD.
This commit is contained in:
parent
1af42b3d50
commit
8d26760671
1 changed files with 3 additions and 4 deletions
|
@ -803,18 +803,17 @@ CCMD (writemidi)
|
||||||
}
|
}
|
||||||
|
|
||||||
TArray<uint8_t> midi;
|
TArray<uint8_t> midi;
|
||||||
FILE *f;
|
|
||||||
bool success;
|
bool success;
|
||||||
|
|
||||||
static_cast<MIDIStreamer *>(currSong)->CreateSMF(midi, 1);
|
static_cast<MIDIStreamer *>(currSong)->CreateSMF(midi, 1);
|
||||||
f = fopen(argv[1], "wb");
|
auto f = FileWriter::Open(argv[1]);
|
||||||
if (f == NULL)
|
if (f == NULL)
|
||||||
{
|
{
|
||||||
Printf("Could not open %s.\n", argv[1]);
|
Printf("Could not open %s.\n", argv[1]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
success = (fwrite(&midi[0], 1, midi.Size(), f) == (size_t)midi.Size());
|
success = (f->Write(&midi[0], midi.Size()) == (size_t)midi.Size());
|
||||||
fclose (f);
|
delete f;
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue