Buchempfehlung
Mikrocomputertechnik mit Controllern der Atmel AVR-RISC-Familie
Mikrocomputertechnik mit Controllern der Atmel AVR-RISC-Familie
Umfassend, aber leicht verständlich führt dieses Buch in die Programmierung von ATMEL AVR Mikrocontrollern ein. [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

fb:porticula NoPaste

Info
Info / Hilfe
Liste
Übersicht / Liste
Neu
Datei hochladen
Suche
Quellcode suchen
Download
Dateidownload

Text File to string very fast

Uploader:Mitgliedmarpon
Datum/Zeit:23.01.2013 10:05:45
Hinweis: Dieser Quelltext ist Bestandteil des Projekts CSED_FB multi-language Windows IDE for FreeBasic, zu dem es auf FreeBASIC-Portal.de eine Projektseite gibt.

'Text File  to string very fast
'
'usage:  mes = File_String(Name_File As String) As String
'
'
Function File_String(Nom_File As String) As String
    Dim fileData As UByte Ptr
    Dim  As Integer fileSize, result
    Dim  As Integer myHandle
    Dim As String cont
    myHandle = Freefile()
    result = Open (Nom_File For Binary As #myHandle )
    If result <> 0 Then
       Function= ""
       Exit Function
    EndIf
    fileSize = LOF(myHandle)
    If fileSize=0 Then
       Function =""
       Close #myHandle

       Exit Function
    EndIf
    fileData = Allocate(fileSize)
    Get #myHandle, 0, *fileData, fileSize
    Close #myHandle
    cont= *fileData

    Function = Left$(cont,fileSize)

    Sleep(1)
    Deallocate(fileData)
End Function