D. Write a program for creating a text file named "student.txt" and write two lines in it. What will be position of file pointer if you read one line?
Answers
Answered by
1
Answer:
Python:-
with open("student.txt", "w") as f:
f.writelines(["This is a file", "Hello World"])
Java:-
import java.io.*;
public class FileDemo {
public static void main(String[] args) throws Exception {
PrintWriter p = new PrintWriter("student.txt");
p.println("This is a file");
p.println("Hello World");
p.close();
}
}
C:-
#include<stdio.h>
int main() {
FILE *fp = fopen("student.txt", "w");
fprintf(fp, "%s\n", "This is a file");
fprintf(fp, "%s\n", "Hello World");
fclose(fp);
return 0;
}
After reading one line the position of the file pointer will be at the start of the second line, before Hello World
Please mark me as the brainliest.
Similar questions
Social Sciences,
17 days ago
Science,
17 days ago
English,
1 month ago
Computer Science,
1 month ago
Chemistry,
9 months ago
English,
9 months ago