Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Datei kopieren, löschen und verschieben

Empfohlene Antworten

Veröffentlicht

Hi,

wie kann ich mit C/C++ eine Datei kopieren, löschen und verschieben? Ich habe es schon mit der Funktion System() probiert, mit der es auch funktioniert. Aber leider erscheint dann das command window, welches nicht eingeblendet werden soll.

TIA

verschieben:

BOOL MoveFile(

LPCTSTR lpExistingFileName, // pointer to the name of the existing file

LPCTSTR lpNewFileName // pointer to the new name for the file

);

und mit Umbenennen:

MoveFileEx

The MoveFileEx function renames an existing file or directory.

BOOL MoveFileEx(

LPCTSTR lpExistingFileName, // pointer to the name of the existing file

LPCTSTR lpNewFileName, // pointer to the new name for the file

DWORD dwFlags // flag that specifies how to move file

);

löschen:

DeleteFile

The DeleteFile function deletes an existing file.

BOOL DeleteFile(

LPCTSTR lpFileName // pointer to name of file to delete

);

kopieren:

CopyFile

The CopyFile function copies an existing file to a new file.

BOOL CopyFile(

LPCTSTR lpExistingFileName,

// pointer to name of an existing file

LPCTSTR lpNewFileName, // pointer to filename to copy to

BOOL bFailIfExists // flag for operation if file exists

);

Ansonsten nochmal die komplette Liste:

File Functions

The following functions are used with files.

AreFileApisANSI

CancelIo

CopyFile

CopyFileEx

CopyProgressRoutine

CreateDirectory

CreateDirectoryEx

CreateFile

CreateIoCompletionPort

DefineDosDevice

DeleteFile

FileIOCompletionRoutine

FindClose

FindCloseChangeNotification

FindFirstChangeNotification

FindFirstFile

FindFirstFileEx

FindNextChangeNotification

FindNextFile

FlushFileBuffers

GetBinaryType

GetCurrentDirectory

GetDiskFreeSpace

GetDiskFreeSpaceEx

GetDriveType

GetFileAttributes

GetFileAttributesEx

GetFileInformationByHandle

GetFileSize

GetFileType

GetFullPathName

GetLogicalDrives

GetLogicalDriveStrings

GetLongPathName

GetQueuedCompletionStatus

GetShortPathName

GetTempFileName

GetTempPath

LockFile

LockFileEx

MoveFile

MoveFileEx

PostQueuedCompletionStatus

QueryDosDevice

ReadDirectoryChangesW

ReadFile

ReadFileEx

ReadFileScatter

ReadFileVlm

RemoveDirectory

SearchPath

SetCurrentDirectory

SetEndOfFile

SetFileApisToANSI

SetFileApisToOEM

SetFileAttributes

SetFilePointer

SetVolumeLabel

UnlockFile

UnlockFileEx

WriteFile

WriteFileEx

WriteFileGather

WriteFileVlm

Obsolete Functions

_hread

_hwrite

_lclose

_lcreat

_llseek

_lopen

_lread

_lwrite

OpenFile

SetHandleCount

Hi,

Danke für deine Antwort.

Aber irgendwie komme ich damit nicht so richtig zu recht.

Kannst du mir vielleicht etwas weiterhelfen? Ein Beispiel oder so?

TIA

CopyFile ("c:\\windows\\java.exe","c:\\temp",true);

MoveFile ("c:\\temp\\java.exe","c:\\");

MoveFileEx ("c:\\java.exe","c:\\tmp\\test.ini",MOVEFILE_REPLACE_EXISTING);

DeleteFile ("c:\\tmp\\test.ini");

Danke, habe er aber bereits schon rausgefunden. Hatte einen kleinen "Denkfehler".

  • 4 Wochen später...

CopyFile ("c:\\windows\\java.exe","c:\\temp",true);

Wofür ist der Parameter true. Hab da jetzt mal false eingegeben und es funzt trotzdem! Er kopiert trotzdem alles!

Patrick

Alles hier nachzulesen:

CopyFile

The CopyFile function copies an existing file to a new file.

BOOL CopyFile(

LPCTSTR lpExistingFileName,

// pointer to name of an existing file

LPCTSTR lpNewFileName, // pointer to filename to copy to

BOOL bFailIfExists // flag for operation if file exists

);

Parameters

lpExistingFileName

Pointer to a null-terminated string that specifies the name of an existing file.

lpNewFileName

Pointer to a null-terminated string that specifies the name of the new file.

bFailIfExists

Specifies how this operation is to proceed if a file of the same name as that specified by lpNewFileName already exists. If this parameter is TRUE and the new file already exists, the function fails. If this parameter is FALSE and the new file already exists, the function overwrites the existing file and succeeds.

Jo danke! Hab ich oben nicht gesehen! :eek:

Danke für die schnelle Antwort. :)

Patrick

  • 4 Jahre später...

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.