Breaking

रविवार, 19 अप्रैल 2020

bca 2nd Sem Notes -Opening modes of files

  • UNIT-I (Array)
Definition
Declaration & initialization of 1D 
Accessing array elements
Displaying array elements
Sorting arrays
Arrays and function
Declaration & initialization of 1D
Accessing and Displaying
Memory representation of array [Row Major, Column Major]
Multidimensional array






  • UNIT-II (Pointers)
  • Definition
    Declaration & initialization
    Indirection operator
    address of operator
    pointer arithmetic
    dynamic memory allocation
    arrays and pointers
    function and pointers






  • UNIT-III (Strings)





  • UNIT-IV (Structures)
  • Definition





  • UNIT-V                                  (C Preprocessor)





  • UNIT-VI                                (File Handling)


  • Opening modes of files



    Various File Opening Modes:

    The file is opened using fopen() function, while opening you can use any of the following mode as per the requirement.
    Mode “r”: It is a read only mode, which means if the file is opened in r mode, it won’t allow you to write and modify content of it. When fopen() opens a file successfully then it returns the address of first character of the file, otherwise it returns NULL.
    Mode “w”: It is a write only mode. The fopen() function creates a new file when the specified file doesn’t exist and if it fails to open file then it returns NULL.
    Mode “a”: Using this mode Content can be appended at the end of an existing file. Like Mode “w”, fopen() creates a new file if it file doesn’t exist. On unsuccessful open it returns NULL.
    File Pointer points to: last character of the file.
    Mode “r+”: This mode is same as mode “r”; however you can perform various operations on the file opened in this mode. You are allowed to read, write and modify the content of file opened in “r+” mode.
    File Pointer points to: First character of the file.
    Mode “w+”: Same as mode “w” apart from operations, which can be performed; the file can be read, write and modified in this mode.
    Mode “a+”: Same as mode “a”; you can read and append the data in the file, however content modification is not allowed in this mode.


    कोई टिप्पणी नहीं:

    एक टिप्पणी भेजें