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

Desirable characteristics of an electronic market place, What are the desir...

What are the desirable characteristics of an Electronic Market Place?  Characteristics of an Electronic Market Place:  a. Its electronic, the business center is not a phys

Implementing recursive function the data structure, For executing recursive...

For executing recursive function the data structure used is: For executing recursive function, stack is used as a data structure.

Form an 8 bit adder using 2 four bit adder IC's 7483, How will you form an ...

How will you form an 8 bit adder using 2 four bit adder IC's 7483? Ans: 4 bit adder IC is IC 7483. This has two four bit data inputs and output carry, 4 bit data output carr

What are the aspects of CAD, What are the aspects of CAD Increased use ...

What are the aspects of CAD Increased use of computers has led to many of the above affects. Other aspects to consider include: -  deskilling of the work force (for illustra

Experiment with neural network, Assignment 3.b: Experiment with Neural Netw...

Assignment 3.b: Experiment with Neural Network Background: In this assignment, you will experiment with neural network for solving different types of practical problems. Y

What is the advantage of dividing an email address, What is the advantage o...

What is the advantage of dividing an email address into two parts? The division of an e-mail address in two parts is significant since it achieve two objectives. First, the div

Binary search tree in the descending order, In order to get the information...

In order to get the information kept in a Binary Search Tree in the descending order, one should traverse it in which of the following order?    Right, Root, Left

Find out the decimal equivalent of binary number, The decimal equivalent of...

The decimal equivalent of Binary number 10101 is ? Ans. 1x2 4 + 0x2 3 +1x2 2 +0x2 1 + 1x2 0 = 16 + 0 + 4 + 0 + 1 = 21.

Design a xnor gate and define its work, N number of XNOR gates is linked in...

N number of XNOR gates is linked in series that is the N inputs (A0, A1, A2......) are specified in the subsequently way: A0 and A1 to first XNOR gate and A2 and O/P of First XNOR

String, super string checker

super string checker

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