CFile
-
Was muss ich denn hierfür includieren, damits läuft? Und wo kann ich das das Nächste mal selber nachschauen?
CFile::Remove("tempHilfe1.txt");
-
MFC?
-
Das ist ne MFC Klasse. Du musst #include <afxwin.h> einbinden, dann sollte es gehen..
-
Da taucht leider folgender Fehler auf:
LINK : fatal error LNK1104: Datei "nafxcwd.lib" kann nicht geoeffnet werden
Jemand ne Idee?
-
Vielleicht gibts ja noch ne Möglichkeit Dateien zu löschen
-
Geh mal in VC auf Projekt, Einstellungen und bei Allgemein aus das die MFC Libarys verwendet werden soll...
-
Gordon schrieb:
Vielleicht gibts ja noch ne Möglichkeit Dateien zu löschen
Na sicher, kommt drauf an, welcher Compiler und wie "plattformabhängig" du das machen willst (aber wenn du eh MFC benutzen willst...), kannst du ja auch "remove" benutzen:
MSDN schrieb:
remove, _wremove
Delete a file.int remove( const char *path );
int _wremove( const wchar_t *path );
Routine Required Header Compatibility
remove <stdio.h> or <io.h> ANSI, Win 95, Win NT
_wremove <stdio.h> or <wchar.h> Win NTFor additional compatibility information, see Compatibility in the Introduction.
Libraries
LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail versionReturn Value
Each of these functions returns 0 if the file is successfully deleted. Otherwise, it returns –1 and sets errno either to EACCES to indicate that the path specifies a read-only file, or to ENOENT to indicate that the filename or path was not found or that the path specifies a directory. This function fails and returns -1 if the file is open.
Parameter
path
Path of file to be removed
Remarks
The remove function deletes the file specified by path. _wremove is a wide-character version of _remove; the path argument to _wremove is a wide-character string. _wremove and _remove behave identically otherwise. All handles to a file must be closed before it can be deleted.
Generic-Text Routine Mappings
TCHAR.H Routine _UNICODE & _MBCS Not Defined _MBCS Defined _UNICODE Defined
_tremove remove remove _wremoveExample
/* REMOVE.C: This program uses remove to delete REMOVE.OBJ. */
#include <stdio.h>
void main( void )
{
if( remove( "remove.obj" ) == -1 )
perror( "Could not delete 'REMOVE.OBJ'" );
else
printf( "Deleted 'REMOVE.OBJ'\n" );
}Output
Deleted 'REMOVE.OBJ'
File Handling Routines
See Also _unlink
-
Dieser Thread wurde von Moderator/in HumeSikkins aus dem Forum C++ in das Forum MFC mit dem Visual C++ verschoben.
Im Zweifelsfall bitte auch folgende Hinweise beachten:
C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?Dieses Posting wurde automatisch erzeugt.
-
also, zu "nafxcwd.lib":
bei mir ( vc 6.0) fehlte die datei am anfang nach der installation auch.
ich hab dann ma mit der wind00f-suche auf der install-cd gesucht,
und die datei auch gefunden. dann einfach zu den anderen libs kopieren, passt schon...