BlackBoard (http://www.black-board.net/index.php)
- Design, Programmierung & Entwicklung (http://www.black-board.net/board.php?boardid=55)
-- Programmieren (http://www.black-board.net/board.php?boardid=4)
--- VB Neue Datei erstellen (http://www.black-board.net/thread.php?threadid=9251)


Geschrieben von @nU615 am 21.12.2002 um 14:48:

Achtung Neue Datei erstellen

Ist es möglich mit Visual Basic eine neue Datei auf der Festplatte zu erstellen, auf die man danach noch während der Laufzeit zugreifen kann?

Thx @nU615



Geschrieben von Compuholic am 21.12.2002 um 15:29:

 

Ich kann wie üblich wieder nur mal mit WinAPI dienen.

Die Funktionen die Du wahrscheinlich brauchst sind:

CreateFile() öffnet oder erzeugt eine Datei und gibt ein Handle zurück
ReadFile() selbsterklärend
WriteFile() selbsterklärend

Ich hab hier mal einen kleinen Auszug aus meine API-Doku...

CreateFile...
Zitat:

The CreateFile function creates, opens, or truncates a file, pipe, communications resource, disk device, or console. It returns a handle that can be used to access the object. It can also open and return a handle to a directory.

HANDLE CreateFile(

LPCTSTR lpFileName, // address of name of the file
DWORD dwDesiredAccess, // access (read-write) mode
DWORD dwShareMode, // share mode
LPSECURITY_ATTRIBUTES lpSecurityAttributes, // address of security descriptor
DWORD dwCreationDistribution, // how to create
DWORD dwFlagsAndAttributes, // file attributes
HANDLE hTemplateFile // handle of file with attributes to copy
);

WriteFile...
Zitat:

BOOL WriteFile(

HANDLE hFile, // handle of file to write to
LPCVOID lpBuffer, // address of data to write to file
DWORD nNumberOfBytesToWrite, // number of bytes to write
LPDWORD lpNumberOfBytesWritten, // address of number of bytes written
LPOVERLAPPED lpOverlapped // addr. of structure needed for overlapped I/O
);

ReadFile...
Zitat:

BOOL ReadFile(

HANDLE hFile, // handle of file to read
LPVOID lpBuffer, // address of buffer that receives data
DWORD nNumberOfBytesToRead, // number of bytes to read
LPDWORD lpNumberOfBytesRead, // address of number of bytes read
LPOVERLAPPED lpOverlapped // address of structure for data
);


Forensoftware: Burning Board 2.3.6, entwickelt von WoltLab GmbH