1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Citrus2011 [14]
3 years ago
11

What function can be used to detect when the end of an input file has been reached?

Computers and Technology
1 answer:
il63 [147K]3 years ago
7 0

Answer:

getc() or feof() in c/c++.

Explanation:

getc() returns EOF(End of File) when the end of the file reached is reached but it is not efficient because it also return EOF when it fails.

feof() returns non-zero value when the EOF is reached otherwise it return 0.So feof() is an efficient method to read a file.

For example:-

#include <stdio.h>    

int main()  

{  

 FILE *f = fopen("sample.txt", "r");  

 int c = getc(f);  

 while (c!= EOF)  

 {  

    putchar(ch);  

   ch = getc(f);  

 }  

 if (feof(f))  

    printf("\n File has ended.");  

 else  

    printf("\n Reading not happened.");  

 fclose(f);

 getchar();  

 return 0;  

}

You might be interested in
PLZZZ HELP MEE i need it done today
Marianna [84]

Answer:

1. B

2. C

Explanation:

7 0
3 years ago
You are creating a story map about Mexico. After configuring the web app template, you launch the app to test it. When the app o
navik [9.2K]
Nbdjsksjsidjdjwkwejd
3 0
3 years ago
What is most important for you to choose before you build a network?
lbvjy [14]

i'm needing help with the same question but mine gave choices, could you help please? thanks

A.  

private network

B.  

NOS

C.  

network media

D.  

network protocol

E.  

directory service

3 0
4 years ago
Someone who is young, lacks funds, and really wants to gain technical skills while serving his or her nation should consider
Scilla [17]
Hello there!

They already gave you the answer just by saying "while serving his or her nation". So, the only way you can serve your nation is when you join the military.

So, the correct missing word is Joining the military.


I hope this helps!
6 0
4 years ago
Consider the code fragment below (with nested loops). int sum = 0;for (int i = 1; i &lt; 5; i++) for (int j = 1; j &lt;= i; j++)
sammy [17]

Answer:

Option d is the correct answer for the above question.

Explanation:

  • The first loop of the program has a second loop and then the statement. In this scenario, the second loop executes for the value of the first loop and the statement executes for the value of the second loop.
  • The first loop executes 4 times, Then the second loop or inner loop executes n times for the n iteration of the first loop, for example, 1 time for the first iteration of the first loop, 2 times for the second iteration of the first loop and so on.
  • Then the inner loop executes (1+2+3+4) iteration which gives the result 10 iterations.
  • The sum initial value is 0 and the "sum++", increase the value of the sum by 1.
  • So the value of the sum becomes 10 after completing 10 iterations of the inner for loop.
  • Hence the 10 will be the output. So the Option d is the correct answer while the other is not.
3 0
3 years ago
Other questions:
  • Which statement is true? Group of answer choices Variables cannot be assigned and declared in the same statement Variable names
    5·1 answer
  • Search engines that search other search engines are called
    12·2 answers
  • Which key is used in word processors to create indentations?
    13·2 answers
  • Write a function shampoo_instructions() with parameter num_cycles. If num_cycles is less than 1, print "Too few.". If more than
    7·1 answer
  • What do developers do to support software products? explain to users which development process model was used to make the produc
    8·1 answer
  • Can web sites contain copyright material? <br> Yes <br> No
    10·2 answers
  • You are planning trip to South America and and are worried about your devices with private keys being stolen. So you decide to s
    9·1 answer
  • Travis just got promoted to network administrator after the previous administrator left rather abruptly. There are three new hir
    14·1 answer
  • 70 point Brainlist to best answer
    15·1 answer
  • "necessarily is the mother of computer " justify this statement with respect to the evolution of computer.​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!