Warning: SQLite3::query(): database is locked in /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php on line 63

Warning: SQLite3::query(): database is locked in /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php on line 75

Warning: SQLite3::query(): database is locked in /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php on line 80

Warning: SQLite3::query(): database is locked in /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php on line 104

Warning: SQLite3::query(): database is locked in /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php on line 115

Warning: SQLite3::query(): database is locked in /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php on line 120

Warning: SQLite3::query(): database is locked in /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php on line 149

Warning: SQLite3::query(): database is locked in /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php on line 161

Warning: SQLite3::query(): database is locked in /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php on line 166

Warning: SQLite3::query(): database is locked in /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php on line 196

Warning: SQLite3::query(): database is locked in /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php on line 208

Warning: SQLite3::query(): database is locked in /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php on line 214

Warning: http_response_code(): Cannot set response code - headers already sent (output started at /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php:63) in /var/www/html/vendor/miniframe/core/src/Core/Bootstrap.php on line 115

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php:63) in /var/www/html/vendor/miniframe/core/src/Core/Bootstrap.php on line 117

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php:63) in /var/www/html/vendor/miniframe/core/src/Core/Bootstrap.php on line 117

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php:63) in /var/www/html/vendor/miniframe/core/src/Core/Bootstrap.php on line 117

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php:63) in /var/www/html/vendor/miniframe/core/src/Core/Bootstrap.php on line 117

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php:63) in /var/www/html/vendor/miniframe/core/src/Core/Bootstrap.php on line 117

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php:63) in /var/www/html/vendor/miniframe/core/src/Core/Bootstrap.php on line 117

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php:63) in /var/www/html/vendor/miniframe/core/src/Core/Bootstrap.php on line 117
Stefan Thoolen .nl | VB6 Function Database

Visual Basic 6 function "file"

Go back

Below you'll find the source for the Visual Basic 6 function file.

Attribute VB_Name = "modFile"
' These functions are downloaded from:
' http://www.stefanthoolen.nl/archive/vb6-functions/
' 
' You may freely distribute this file but please leave all comments, including this one, in it.
' 
' @Author Stefan Thoolen <mail@stefanthoolen.nl>

Option Explicit

''
' Reads entire file into a string
' Almost the same syntax as the PHP function 'file_get_contents'
' See also: http://www.php.net/manual/en/function.file-get-contents.php
' @param    String  filename        The file to read
' @return   String                  The contents of the file
' @author   Stefan Thoolen <mail@stefanthoolen.nl>
Public Function file_get_contents(filename As String) As String
    Dim thedata As String, ff As Integer
    ' Note, length of 'TheData' will determine how many bytes are read.
    ff = FreeFile
    Open filename For Binary Access Read Shared As #ff
        thedata = Space(LOF(ff))
        Get #ff, 1, thedata
    Close #ff
    
    file_get_contents = thedata
End Function

''
' Gets a file as an array
' Almost the same syntax as the PHP function 'file'
' See also: http://www.php.net/manual/en/function.file.php
' @param    String  filename        The file we want to read
' @return   Variant                 An array with each line of the file
' @author   Stefan Thoolen <mail@stefanthoolen.nl>
Public Function file(filename As String) As Variant
    Dim retval() As String, s As String, l As Long
    s = file_get_contents(filename)
    retval = Split(s, vbLf)
    For l = LBound(retval) To UBound(retval)
        retval(l) = retval(l) & vbLf
    Next l
    
    file = retval
End Function