vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
SEPA-Dateien erstellen inkl. IBAN-, BLZ-/Kontonummernprüfung  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2025
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

Visual-Basic Einsteiger
VB.NET & Fileget 
Autor: Aalamar
Datum: 23.09.01 19:14

Hi,

hat jemand schon mal was mit VB.NET gemacht??? Ich versuch eine Datei im Binary Mode zu öffnen und verwende dazu Fileopen und Fileget von VB.NET. Leider komme ich aber nicht an die ersten 2 Bytes. Auch wenn ich genau das Beispiel aus der Hilfe nehme gehts nicht. Ich hab dazu eine TXT Datei erstellt, in der nur "Hello World" steht.

Dann hab ich das aus der Hilfe genommen.

Dim hellow As New String(" ", 11)
FileOpen(1, "C:TEST.txt", OpenMode.Binary)
FileGet(1, hellow)
MsgBox(hellow)
FileClose(1)

Als Ausgabe bekomme ich "llo World". Es fehlen die ersten 2 Bytes. In der Doku zu Fileget steht noch folgendes:
If the variable being read into is a string, by default FileGet reads a 2-byte descriptor containing the string length and then reads the data that goes into the variable. Therefore, the record length specified by the RecordLength clause of the FileOpen function must be at least 2 bytes greater than the actual length of the string. Visual Basic 6 and earlier versions supported fixed length strings and when put to a file, the length descriptor would not be written.

und

For files opened in Binary mode, all of the Random rules apply, except:
The RecordLength clause in the FileOpen function has no effect. FileGet reads all variables from disk contiguously; that is, with no padding between records.
For any array other than an array in a structure, FileGet reads only the data. No descriptor is read.
FileGet reads variable-length strings that aren't elements of structures without expecting the 2-byte length descriptor. The number of bytes read equals the number of characters already in the string. For example, the following statements read 11 bytes from file number 1: Hier kommt dann das Beispiel von oben...

cu
Aalamar
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
VB.NET & Fileget63Aalamar23.09.01 19:14
Hi logisch...669unbekannt23.09.01 19:20
Re: Hi logisch...38Aalamar23.09.01 19:32
Re: Hi logisch...34aalamar24.09.01 14:01

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2025 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel