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

C, Write a ‘C’ functions to arrange the elements of an integer array in suc...

Write a ‘C’ functions to arrange the elements of an integer array in such a way that all the negative elements are before the positive elements. The array is passed to it as an arg

Explain about octal numbers system, Q. Explain about Octal Numbers system? ...

Q. Explain about Octal Numbers system? An octal system has 8 digits signified as 0,1,2,3,4,5,6,7. For finding equal decimal number of an octal number one has to find quantity o

Explain proces of defining the document page title, Q. Explain proces of de...

Q. Explain proces of defining the Document Page Title? Though the document has a file name, notice it's still labelled Untitled Document; that is because it needs an HTML docum

Define emulation, Define emulation. Given a computer with a particular ...

Define emulation. Given a computer with a particular instruction set, it is possible to explain additional machine instructions and execute them with extra micro routines. Emul

Linux, Explain about unix file system architecture

Explain about unix file system architecture

Examples of artificial neural networks, Examples of artificial neural netwo...

Examples of artificial neural networks: Now here as an example consider a ANN that has been trained to learn the following rule categorising the brightness of 2x2 black and wh

Name some multimedia applications, Illustrate what are the Multimedia appli...

Illustrate what are the Multimedia applications Multimedia comprise the use of a computer to present: - Text - Video - Graphics - Sound - Animation In an inte

What are the advantages of batch processing, What are the advantages of bat...

What are the advantages of batch processing This has the advantage which jobs can be processed when computer resources are less busy (for example during the evening or at night

Does weblogic jms support clustering, WebLogic JMS handles cluster-wide, tr...

WebLogic JMS handles cluster-wide, transparent access to destinations from any server in the cluster. A system administrator can set up cluster-wide, transparent access to destinat

Describing Random Algorithm, Suppose you''re given n numbers and asked to f...

Suppose you''re given n numbers and asked to find a number that is greater than or equal to the median a) What is the lower bound for the worst case complexity of this problem?

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