Monday, 31 August 2015

Tool Command Language- Lecture 9 (files)

In this lecture we will see how to read file from disk
The general format is as 

open file _name access permission 

access is the access mode

r.... open the file for reading . The file must b present.
r+...open a file for reading and writing.
w.. open the file for writing. create the file if it is not present.
w+.. open file for reading and writing.. create if not present.
a.. open file for writing . it must be present their.
a+.. open file for writing and create it if not present their.

permission :

permission is an integer to use  to set the file access permissions

close fileID:

closes the file that has been already created.

gets fileID varnamee:

reads a line from fileID and discards the terminating newline.

puts ? -nonewline? fileID string

writes in file.

Examples:
i have a file abc.text in this location \hoome\masroor.
a:
set ns
open \home\masroor\abc  r 
returns file3 which is file id
now i will use this id to close file
close file3

b:
open /home/masroor/abc w+
puts file4 "i hate this "
close file4


No comments:

Post a Comment

Grammar Mistakes in Technical Paper Writing

Let me share some experience in this post with you. I'm currently in the second year of my Ph.D. program. We are in the middle of paper...