---
title: "readLine"
canonical: "https://help.vicon.com/space/ShogunPost121/1253737732/readLine"
format: markdown
---
# Description

Use to read a whole line of text from a file. Will read up until a newline character is encountered, or until 1024 characters have been read, whichever comes first.

Command will fail if at the end of the file.

## Functional area

Disk I/O

# Command syntax

## Syntax

> Macro (scroll-tablelayout)

|  |
| --- |
| `readLine fileID` |

### Arguments

| Name | Type | Required | Comments |
| --- | --- | --- | --- |
| `fileID` | int |  | ID of file previously opened with [fileOpen](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253738450) |

### Flags

None

## Return value

string

> Macro (scroll-pagebreak)

## Examples

```plaintext
string $line;
int $fileID;
  
// Open a sample text file 
$fileID = `fileOpen "c:/samplefile.txt" "r"`;
  
// Keep reading in lines from the file
while( `isEndOfFile $fileID` == false )
{ 
$line = `readLine $fileID`; 
// Do something with line 
print $line;
}
```

# Additional information

## Related commands

- [readString](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253736766)
- [readToken](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737987)