February 25, 2021, 02:44:15 AM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Forum
Help
Search
Gallery
Login
Register
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
File Utilities
»
[bb] ReadFileAsString$() by Difference [ 1+ years ago ]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [bb] ReadFileAsString$() by Difference [ 1+ years ago ] (Read 513 times)
BlitzBot
Jr. Member
Posts: 1
[bb] ReadFileAsString$() by Difference [ 1+ years ago ]
«
on:
June 29, 2017, 12:28:40 AM »
Title :
ReadFileAsString$()
Author :
Difference
Posted :
1+ years ago
Description :
Read a file into a string, fast.
Code :
Code: BlitzBasic
Function
ReadFileAsString$
(
file$
)
Local
tmp$=
SystemProperty
(
"tempdir"
)
+
MilliSecs
(
)
+
"bbrsrf.tmp"
Local
ret$
Local
fbank=
CreateBank
(
FileSize
(
file$
)
)
f=
OpenFile
(
file$
)
If
Not
f
FreeBank
fbank :
Return
""
ReadBytes
fbank,f,
0
,
BankSize
(
fbank
)
CloseFile
f
f=
WriteFile
(
tmp$
)
If
Not
f
FreeBank
fbank :
Return
""
WriteInt
f,
BankSize
(
fbank
)
WriteBytes
fbank,f,
0
,
BankSize
(
fbank
)
CloseFile
f
f=
OpenFile
(
tmp$
)
If
Not
f
FreeBank
fbank :
Return
""
ret$=
ReadString
(
f
)
CloseFile
f
FreeBank
fbank
DeleteFile
tmp$
Return
ret$
End Function
Comments :
none...
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
File Utilities
»
[bb] ReadFileAsString$() by Difference [ 1+ years ago ]
SimplePortal 2.3.6 © 2008-2014, SimplePortal