OKi okresl w jakim srodowisku piszesz (albo czy musi byc takie). Czy musi to byc ANSII (i io...), czy dowolny sposob i srodowisko. Oraz powiedz jaki kompilator chociaz do mniej wazne od srodowiska. Dla iostream nieiwm jak dokladnie jest, jakos nieprzepadam preferuje fopen("blabla",);
dla fopen(...., "w+"); -> otworzy plik a jesli go niema to utworzy nowy
dla fopen(...., "a"); -> dopisuje na koniec plik jesli go niema to tworzy nowy (ew z + to zalezy od kompilatora

)
oczywiscie zanim skasujesz ten plik zamknij go fclose(...);
Tylk to pewno by wymagalo sporej przebudowy kodu bo innaczej sie czyta i zapisuje. Jesli Jesli chcesz usunac ten plik "fizycznie" zeby go niebylo a nie zapisac go to w Win SDK
BOOL DeleteFile(
LPCTSTR lpFileName
);
=======================================
DeleteFile
The DeleteFile function deletes an existing file.
BOOL DeleteFile(
LPCTSTR lpFileName
);
Parameters
lpFileName
[in] Pointer to a null-terminated string that specifies the file to be deleted.
In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see Naming a File.
Windows Me/98/95: This string must not exceed MAX_PATH characters.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
[...]
Requirements
Client: Included in Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, and Windows 95.
Server: Included in Windows Server 2003, Windows 2000 Server, and Windows NT Server.
Unicode: Implemented as Unicode and ANSI versions. Note that Unicode support on Windows Me/98/95 requires Microsoft Layer for Unicode.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.
=======================================
i to by bylo proste bo niemusialbys zmieniac calego kodu. (chociaz pewno cos zle robisz przy otwieraniu bo napewno da sie wyczyscic plik i go zapisac od "0" na stream'ach)
jesli ci sie to nieuda to mozesz zrobic troche "oblesna" metoda ale napewno skuteczna (tylko musisz zamknac plik przed tym. system("del twoj.plik")
oks znalazlem tez dla ANSII:
Delete a file.
int remove(
const char *path
);
<stdio.h> or <io.h> ANSI, Win 98, Win Me, Win NT, Win 2000, Win XP
"
// crt_remove.c
/* This program uses remove to delete crt_remove.txt */
#include <stdio.h>
int main( void )
{
if( remove( "crt_remove.txt" ) == -1 )
perror( "Could not delete 'CRT_REMOVE.TXT'" );
else
printf( "Deleted 'CRT_REMOVE.TXT'\n" );
}
"