How to write a few lines to a file? For some reason, all functions ignore '\ n'. For example:
package main import ( "os" ) func main() { file, _ := os.Create("A.txt") file.WriteString("AAA\nBBB") }
This code is written to the A.txt file AAABBB
.
On Windows, in contrast to Unix-like systems, the combination of CR-LF is used to translate a string, it is also \r\n
. See table .
Source: https://ru.stackoverflow.com/questions/970768/
All Articles
\r\n
it is necessary to do. - Ainar-G