Explain opening files for reading only in c, Computer Engineering

Assignment Help:

Opening Files for Reading Only    : A data file is a file that you can open and read its contents visually - for example, C source files, .dat files, HTML etc - anything that looks "neat" in Notepad. A binary file is a file that is written in machine code - usually seen as a mass of weird characters in Notepad! Examples are bitmaps, executables etc. To open a data file for reading only, pass "r" as the second argument of fopen, as demonstrated in this example:

#include

int main()

{

FILE *file; /* declare a FILE pointer */

file = fopen("data/hello.dat", "r");

/* open a text file for reading */

if(file==NULL)

{

}

else

{

}

}

printf("Error: can't open file.\n");

fclose(file); /*DON'T PASS A NULL POINTER TO fclose !! */

return 1;

 

 


Related Discussions:- Explain opening files for reading only in c

Calculating block size - computer architecture, Calculating Block Size: ...

Calculating Block Size: B A unit of associatively -one tag for B A words B T unit of transfer-B T words to/from primary memory as a unit             One valid bit for

State about the object oriented analysis, State about the Object oriented a...

State about the Object oriented analysis Object oriented analysis (OOA) is concerned with developing software engineering specifications and requirements that expressed as a s

What you mean by organizational effectiveness, Q. What you mean by organiza...

Q. What you mean by organizational effectiveness? Organizational effectiveness is measured in terms of productivity, structural flexibility, Employee involvement and Job satisf

Explain message, Differentiate between message switching, packet switching ...

Differentiate between message switching, packet switching and circuit switching Message switching: Recourse computer sends data to switching office that stores the data in

Search-based tools in parallel computers, The search-based tools initially ...

The search-based tools initially recognize problem and afterwards suitably give advice on how to correct it.  AT Expert from Cray Research is one of the tools being employed for

Basic architecture of computer system, Q. Basic Architecture of computer sy...

Q. Basic Architecture of computer system? Replacing the ALU and CU (i.e., CPU) of Figure by a microprocessor, and storing instructions and data in the same memory, one arrives

.image forgery detection, what is the code to detect image forgery using Ma...

what is the code to detect image forgery using Matlab..??

Explain working of digital camera, Q. Explain working of Digital camera? ...

Q. Explain working of Digital camera? A Digital camera is a camera which captures and stores still images and video (Digital Video Cameras) as digital data in place of on photo

What is connection, An established communication session among a server and...

An established communication session among a server and a workstation.

Define the concept of typing of object oriented analysis, Define the concep...

Define the concept of Typing of object oriented analysis Typing enforces object class such that objects of different classes cannot be interchanged.  Or we can say that, class

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd