---
title: "readLine"
canonical: "https://help.vicon.com/space/Shogun114/196389810/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

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

### Arguments

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

### 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/Shogun114/pages/196380432)
- [readToken](https://vicon-help.atlassian.net/wiki/spaces/Shogun114/pages/196387253)