java:
BufferedReader br = new BufferedReader(new FileReader("filename"));
String line = null;
while ((line = br.readLine()) != null) {
// process the line
}
Python:
with open('filename') as f:
for line in f.readlines():
# process the line
C++:
ifstream f("filename");
string line;
while (getline(f, line) {
// process the line
}