[DOS] Delete/CopyFile
-
Hallo zusammen,
ich muss gerade eine Anwendung von Win32 nach Dos portieren
...ja ich weiß klingt komisch aber ich brauche dennoch eure Hilfe.Ich verwende die Win32 Funktion DeleteFile und CopyFile.
Wie mache ich das unter DOS?Danke schon mal im Voraus.
Bye Peter.
-
kommt drauf an, ob du wirklich 16 bit dos meinst, ansonsten könntest du weiter mit windows arbeiten.
für löschen würde ich mir dann unlink anschauen:unlink Syntax #include <unistd.h> int unlink(const char *file); Description This function removes a file from the file system. Return Value Zero on success, nonzero on failure. Portability not ANSI, partially POSIX (see note 1) Notes: The POSIX specification requires this removal to be delayed until the file is no longer open. Due to problems with the underlying operating systems, this implementation of unlink does not fully comply with the specs; if the file you want to unlink is open, you're asking for trouble -- how much trouble depends on the underlying OS. On Windows NT (and possibly on Windows 2000 as well), you get the behaviour POSIX expects. On Windows 9x and Windows ME (and possibly Windows XP as well), the removal will simply fail (errno gets set to EACCES). On DOS, removing an open file could lead to filesystem corruption if the removed file is written to before it's closed. Example unlink("data.txt");
-
ist leider wirklich 16-Bit.
Und "removing an open file could lead to filesystem corruption if"
macht mir doch schon etwas angstBye Peter.
-
einfacher..
--------------------------------------------------------------------------------
remove
Syntax
#include <stdio.h>int remove(const char *file);
Description
This function removes the named file from the file system. Unless you have an un-erase program, the file and its contents are gone for good.Return Value
Zero on success, nonzero on failure.Portability
ANSI, POSIXExample
remove("/tmp/data.tmp");kopie musst du selber machen
-
Und wenn du eine Datei einfach nur verschieben oder unbenennen willst, dann gibts da noch rename()
-
danke für die schnelle Hilfe.
Wenn du mit "selber machen" meinst ich soll
die Datei einlesen und dann in eine andere
schreiben...das habe ich gerade gemacht.Danke nochmal
Bye Peter.