Repository navigation
Loc
Home › File I/O Functions › LOC
Returns where the last read or write happened in an open file, counted in records.
Declare Function LOC ( ByVal filenum As Long ) As LongIntfilenum
Returns the position where the last file read/write was performed.
The position is indicated in records:
In files opened FOR RANDOM the record length specified when file was opened is used
In text files (FOR INPUT|OUTPUT|APPEND, a record length of 128 bytes is supposed.
In files opened for BINARY a 1 byte record length is used.
In FreeBASIC the file position is 1 based, the first record of a file is record 1 (LOC=1 after reading or writing the first record, LOC=0 for the start position in the file).
When used with a serial device, LOC returns the number of bytes waiting to be read from the serial device's input buffer.
The file position where the last read/write was performed.
result = LOC( filenum )
- None
Dim b As String
If Open Com ("com1:9600,n,8,1,cs,rs,ds,bin" For Binary As #1) <> 0 Then
Print "unable to open serial port"
End
End If
Print "Sending command: AT"
Print #1, "AT" + Chr(13, 10);
Sleep 500,1
Print "Response:"
While( LOC(1) > 0 )
b = Input(LOC(1), 1)
Print b;
Wend
Close #1Category: File I/O Functions
Kind: function
Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.
tiko-lang · Home · Feature Index · Keyword Index · License
FreeBASIC manual pages reproduced under the GNU FDL 1.3.
- Home
- What Is tiko-lang
- Quick Start
- Installing on macOS
- Debugging
- Feature Index
- Compatibility
- FAQ
- AI Cheatsheet
- Generics
- Interfaces
- For Each
- Iterators
- Tuples
- Array Results
- Defer
- Lambdas
- Block Strings
- Partial Types
- String Slices
- Embed
- Typed Variadics
- C Header Import
- Foreign Library Linking
- UString
- Fixed-Width Types
- Nullptr
- String Library
- Format
- Array
- Map
- Set
- LinkedList
- OrderedMap
- OrderedSet
- Sorting
- Optional
- Result
- Smart Pointers
- Date and Time (Chrono)
- Time Zones
- Filesystem
- File Streams
- Config (INI and TOML)
- Codec
- Hash
- UUID
- OS
- Process
- Net
- HTTP and TLS
- Math Library
- Finance
- Logging
- Terminal TUI Library
- PsControls
- tkControls
- sys/win
- Goroutines and Channels
- LLVM Backend
- tiko build
- TIKO_COMPILER
- Variable Declarations
- Standard Data Types
- User Defined Types
- Procedures
- Operators
- Control Flow Statements
- Converting Data Types
- Array Functions
- String Functions
- Mathematical Functions
- Bit Manipulation
- Date and Time Functions
- File I/O Functions
- Console Functions
- User Input (Runtime Library)
- User Input Functions (Graphics Library)
- Screen Functions
- 2D Drawing Functions
- Graphics Library Reference
- Graphics Keyword List
- Memory Functions
- Threading Support Functions
- Error Handling Functions
- Operating System Functions
- Preprocessor
- Intrinsic Defines
- Miscellaneous Keywords
- Modularizing