Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== OSRead statement ====== ==== Description ==== Reads an entire operating system file into a BASIC+ variable. ==== Syntax ==== **OSRead** //var// From //file// Then Else //statements// ==== Parameters ==== The OSRead statement has the following parameters. ^Parameter^Description^ |//Var//|The variable into which the file will be read.| |//File//|Pass the name of the valid operating system file, including the path, filename, and extension. This is not a file variable.| |Then|Used to define a clause of statements to be executed when the OSRead statement is successful.| |Else|Executed when the OSRead is unsuccessful.|| ==== Remarks ==== OSRead assigns an entire operating system file to the variable, whereas OSBRead assigns a portion of an operating system file to its variable. ==== Returns ==== After the execution of an OSRead statement, the Status() function returns a code indicating the success or failure of the operation. Possible values for Status() are as follows. ^Value^Meaning^ |0|No error.| |1|Bad OS filename.| |2|Access denied by operating system.| |3|Disk or directory full.| |4|File does not exist.| |5|Unknown error.| |6|Attempt to write to a read-only file.| ==== See Also ==== [[osbread|OSBRead]], [[osbwrite|OSBWrite]], [[osclose|OSClose]], [[osdelete|OSDelete]], [[osopen|OSOpen]], [[oswrite|OSWrite]] ==== Example ==== <code> /* read a file into a variable, append data and write the data back to file */ equ tab$ to char(09) equ crlf$ to char(13):char(10) myData = "" filename = "C:\temp\my_data.txt" Set_Status(0) OSRead myData From filename then newline = "Hagbard":tab$:"Celine":tab$:"HM,SH" myData:= crlf$: newline OSWrite myData To filename End else errorCode = status() End </code> guides/programming/programmers_reference_manual/osread.txt Last modified: 2024/06/19 20:20by 127.0.0.1