##### Views

- Page
- Discussion
- View source
- History

# (File):write

Write data to a file.

## Function

### Synopsis

success = File:write( data, size )

### Arguments

`string data`
  The string data to write.
`number size (all)`
  How many bytes to write.

### Returns

`boolean success`
  Whether the operation was successful.

## Function

### Synopsis

success = File:write( data, size )

### Arguments

`Data data`
  The Data object to write.
`number size (all)`
  How many bytes to write.

### Returns

`boolean success`
  Whether the operation was successful.

## Notes

Writing to multiple lines: In Windows, some text editors (e.g. Notepad) only treat CRLF ("\r\n") as a new line.

--example
f = love.filesystem.newFile("note.txt")
f:open("w")
for i = 1, 10 do
f:write("This is line "..i.."!\r\n")
end
f:close()

## See Also

- File
- File:flush
- File:setBuffer

## Other Languages

Dansk – Deutsch – English – Español – Français – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Polski – Português – Română – Slovenský – Suomi – Svenska – Türkçe – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – ไทย – 日本語 – 正體中文 – 简体中文 – Tiếng Việt – 한국어
More info

Retrieved from "https://www.love2d.org/wiki/(File):write"
Categories: Templates | Functions

##### Personal tools

- Log in

##### Search

##### Toolbox

- What links here
- Related changes
- Special pages
- Printable version
- Permanent link
- Browse properties