$lines = file($path);
if ($lines === false)
die("Can't open file $path");
std::ifstream file (path);
for (std::string line; std::getline(file, line); lines.push_back(line)) {}
public List<string> GetLines(string _path)
{
return File.ReadAllLines(_path).ToList();
}
var lines = File(path).readAsLinesSync();
func readLines(path string) ([][]byte, error) {
b, err := os.ReadFile(path)
if err != nil {
return nil, err
}
lines := bytes.Split(b, []byte{'\n'})
return lines, nil
}
func readLines(path string) ([]string, error) {
b, err := os.ReadFile(path)
if err != nil {
return nil, err
}
lines := strings.Split(string(b), "\n")
return lines, nil
}
fs.readFileSync(path).split("\n")
FileReader R = new FileReader(path);
BufferedReader r = new BufferedReader(R);
List<String> lines = r.lines().toList();
r.close();
Scanner s = new Scanner(new File(path));
s.useDelimiter("\\R");
List<String> lines = s.tokens().toList();
s.close();
File f = new File(path);
List<String> lines = readAllLines(f.toPath());
List<String> lines = Files.readAllLines(new File(path).toPath());
String text = Files.readString(new File(path).toPath());
List<String> lines = text.lines().collect(Collectors.toList());
val lines = File(path).readLines()
var
Lines: TStringList;
...
Lines := TStringList.Create;
Lines.LoadFromFile(Path);
my @lines = path($path)->lines;
with open(path) as f:
lines = f.readlines()
lines = open(path).readlines
let lines = BufReader::new(File::open(path).unwrap())
.lines()
.collect::<Vec<_>>();
Dim lines = IO.File.ReadAllLines(path).ToList