DIAdem Help

Content Type
Programming Language
Current manual
Table of Contents

Method: GetCharacters for File

Method: GetCharacters for File

Reads a specific number of characters from the file. The method returns all characters, including delimiters and end of line characters.

sGetCharacters = Object.GetCharacters(Number)
ObjectFile
Object with this method
NumberLongInteger
Specifies the number of characters to read.
sGetCharactersString
Receives the characters that have been read out.
Note  If GetCharacters finds the character "\0" before it has read the specified number of characters, GetCharacters returns only the characters it has read up to that point.

The following example reads up to 1000 characters from a file and determines the end of line character for the file.

Dim BytesToRead, ByteStream, i
BytesToRead = 1000
If (BytesToRead > File.Size) Then BytesToRead = File.Size 
ByteStream = File.GetCharacters(BytesToRead))
If (0 < Instr(ByteStream,vbNewLine)) Then
  File.Formatter.LineFeeds = vbNewLine
ElseIf (0 < Instr(ByteStream,vbCR)) Then
  File.Formatter.LineFeeds = vbCR
ElseIf (0 < Instr(ByteStream,vbLF)) Then
  File.Formatter.LineFeeds = vbLF
End If
In This Section
Was this information helpful?