Computer Systems: Program... -Access
Computer Systems: Program... -Access
3rd Edition
ISBN: 9780134071923
Author: Bryant
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
Chapter 10.3, Problem 10.1PP
Program Plan Intro

Opening and Closing files:

Using “Open” function, a process can open an existing file or generates a new file.

  • This function is used to converts a filename to a file descriptor and returns the result as a descriptor number.
  • The descriptor returned is always the lowest descriptor that is not presently open in the process.
  • Each process in the LINUX begins life with three open files.
    • Descriptor 0 – standard input.
    • Descriptor 1 – standard output.
    • Descriptor 2 – standard error.
  • The “open” function consists of three arguments. That is “Open(filename, flags, mode)”.
    • The argument “filename” defines the name of the given file.
    • The argument “flags” represents how the process plans to access the file. Some flags names are as follows.
      • O_RDONLY – it means reading only.
      • O_WRONLY – it means writing only.
      • O_RDWR – it means reading and writing.
    • The “mode” argument identifies the access permission bits of new files.

Example:

The example for open an existing file for reading is shown below:

sample1 = Open("foo1.txt", O_RDONLY, 0);

From the above “open” function,

  • The filename is “foo1.txt”.
  • Flag name is “O_RDONLY”.
  • Mode is “0”.

Blurred answer
Students have asked these similar questions
PROBLEM 12. [TIME ALLOWED = 5 MINUTES]   Give the contrapositive and converse of the following proposition:   “If it is sunny, then I will go swimming.”
Problem 3 (#2.1.32).Explain why (A×B)×(C×D)and A×(B×C)×D are not the same
3. The diagram below shows the main land routes for vehicular traffic between points A and G in a city. The figures in the arcs represent the cost of traveling between each pair of nodes.   a) Manually apply Dijkstra's algorithm to find the cheapest route between A and G (visited nodes and total distance). b) Formulate a linear programming problem in extended form, to determine the shortest route to travel from A to G. Do not use subscripts, name 14 variables, for example XFE would be the variable that indicates that the arc from F to E is used. c) If there is a fixed cost for visiting each node, modify the formulation of the problem to include said fixed cost in the objective function, and the variables and restrictions that are required.     NODE A B C D E F G FIXED COST 25 18 32 20 28 18 34
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr