Comprog
Comprog
Bautista
Emil A. Corpuz BSCS 1C Comprog2
Source Code:
#include <stdio.h>
int main() {
scanf("%s", filename); // Read the filename entered by the user and store it in
the filename array
// Open the file with the specified filename in "write" mode ("w")
if (file == NULL) {
ScreenShot of Output:
Ralph Roel M. Bautista
Emil A. Corpuz BSCS 1C Comprog2
Write a c program that print the contents of student.text file using feof(), fgets() and printf()
functions.
Source Code:
#include <stdio.h>
int main() {
char filename[] = "student.txt"; // Define the filename for the student data file
if (file == NULL) {
fprintf(file, "Full Name: %s", full_name); // Write full name to the file
if (file == NULL) {
while (!feof(file)) {
char line[100];
Ralph Roel M. Bautista
Emil A. Corpuz BSCS 1C Comprog2
if (fgets(line, sizeof(line), file) != NULL) {
ScreenShot of Output:
Ralph Roel M. Bautista
Emil A. Corpuz BSCS 1C Comprog2
Ralph Roel M. Bautista
Emil A. Corpuz BSCS 1C Comprog2
Ralph Roel M. Bautista
Emil A. Corpuz BSCS 1C Comprog2
Ralph Roel M. Bautista
Emil A. Corpuz BSCS 1C Comprog2
Ralph Roel M. Bautista
Emil A. Corpuz BSCS 1C Comprog2
Ralph Roel M. Bautista
Emil A. Corpuz BSCS 1C Comprog2
Ralph Roel M. Bautista
Emil A. Corpuz BSCS 1C Comprog2
Ralph Roel M. Bautista
Emil A. Corpuz BSCS 1C Comprog2