Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need help modifying my program to do this Read multiple lines from the file. Store the lines in memory, preferably in an array. Create a

need help modifying my program to do this 
  1. Read multiple lines from the file.
  2. Store the lines in memory, preferably in an array.
  3. Create a function to read the data from memory, and print it to stdout.
 #include  int main() { char buffer[1000]; char fileName[20]; FILE *fptr; printf("Enter file name: "); scanf("%s",&fileName); if ((fptr = fopen(fileName, "r")) == NULL) { printf("Error! opening file"); return 0; } // reads text until newline fscanf(fptr, "%[^ ]", buffer); printf("First line in the file is: %s", buffer); fclose(fptr); return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions

Question

Determine the area of the triangle. 3 yd 1 ft

Answered: 1 week ago