LOW LEVEL FILE PROCESSING
|
|
|
- Marsha Reynolds
- 10 years ago
- Views:
Transcription
1 LOW LEVEL FILE PROCESSING 1. Overview The learning objectives of this lab session are: To understand the functions provided for file processing by the lower level of the file management system, i.e. the functions which directly invoke the operating system. To acquire hands-on experience in using the low level IO in C The example presented illustrates the main operations on a file: create, append, update, read. 2. Brief theory reminder A file is an ordered collection of records, stored on external media. The main operations of files are: - open / close an existing file; - create a file; - read / write a file; - set current position in a file (file positioning); - delete a file. File processing can be done in two ways: a) Using the low level functions provided by the file management system; b) Using the high level functions provided by the file management system; A file can be accessed in two modes: - sequential; - random File creation To create a file, you can use the function creat, This function is obsolete. The call: is equivalent to: creat (filename, mode) open (filename, O_WRONLY O_CREAT O_TRUNC, mode) If on a 32 bit machine the sources are translated with _FILE_OFFSET_BITS == 64 the function creat returns a file descriptor opened in the large file mode which enables the file handling functions to use files up to 2^63 in size and offset from -2^63 to 2^63. This happens transparently for the user since all of the low level file handling functions are equally replaced. The function creat64 is also obsolete: int creat64 (const char *filename, mode_t mode) This function is similar to creat. It returns a file descriptor which can be used to access the file named by filename. The only the difference is that on 32 bit systems the file is opened in the large file mode. I.e., file length and file offsets can exceed 31 bits. In these prototypes: T.U. Cluj-Napoca Computer Programming 1
2 - filename - is a pointer to a character string which defines the path name of the file to be created.; - mode - is an integer which can be specified by bitwise or-ing the following access rights: S_IREAD - read right; S_IWRITE - write right. The function returns a file descriptor upon success, and -1 on error. To use the function, one must use the following directives: #include <io.h> #include <sys/stat.h> Important note: opening an existing file by creat causes the loss of file contents. The created file is exploited in mode text (O_TEXT) or binary (O_BINARY), depending on the value of the global variable _fmode (O_TEXT by default). This variable is also deprecated. We recommend the use of the open function Open (an existing) file To open a file use the recommended open function. Its prototype is: int open (const char *filename, int flags[, mode_t mode]) The open function creates and returns a new file descriptor for the file named by filename. Initially, the file position indicator for the file is at the beginning of the file. The argument mode is used only when a file is created, but it doesn't hurt to supply the argument in any case. The flags argument controls how the file is to be opened. This is a bit mask; you create the value by the bitwise OR of the appropriate parameters (using the operator in C. File status flags fall into three categories, which are described in the following sections. - Access Modes, specify what type of access is allowed to the file: reading, writing, or both. They are set by open and are returned by fcntl, but cannot be changed. Access modes are: O_RDONLY: Open the file for read access. O_WRONLY: Open the file for write access. O_RDWR: Open the file for both reading and writing. - Open-time Flags, control details of what open will do. These flags are not preserved after the open call. They are: O_CREAT: If set, the file will be created if it doesn't already exist. O_EXCL: If both O_CREAT and O_EXCL are set, then open fails if the specified file already exists. This is guaranteed to never clobber an existing file. O_NONBLOCK: This prevents open from blocking for a long time to open the file. This is only meaningful for some kinds of files, usually devices such as serial ports; when it is not meaningful, it is harmless and ignored. Often opening a port to a modem blocks until the modem reports carrier detection; if O_NONBLOCK is specified, open will return immediately without a carrier. Note that the O_NONBLOCK flag is overloaded as both an I/O operating mode and a file name translation flag. This means that specifying O_NONBLOCK in open also sets non-blocking I/O mode; see Operating Modes. To open the file without blocking but do normal I/O that blocks, you must call open with O_NONBLOCK set and then call fcntl to turn the bit off. O_TRUNC: Truncate the file to zero length. This option is only useful for regular files, not special files such as directories or FIFOs. POSIX.1 requires that you open the file for writing to use O_TRUNC. T.U. Cluj-Napoca Computer Programming 2
3 - Operating Modes, affect how operations such as read and write are done. They are set by open, and can be fetched or changed with fcntl. The mode flags are: O_APPEND: The bit that enables append mode for the file. If set, then all write operations write the data at the end of the file, extending it, regardless of the current file position. This is the only reliable way to append to a file. In append mode, you are guaranteed that the data you write will always go to the current end of the file, regardless of other processes writing to the file. Conversely, if you simply set the file position to the end of file and write, then another process can extend the file after you set the file position but before you write, resulting in your data appearing someplace before the real end of file. O_NONBLOCK: The bit that enables non-blocking mode for the file. If this bit is set, read requests on the file can return immediately with a failure status if there is no input immediately available, instead of blocking. Likewise, write requests can also return immediately with a failure status if the output can't be written immediately. Note that the O_NONBLOCK flag is overloaded as both an I/O operating mode and a file name translation flag. The normal return value from open is a non-negative integer file descriptor. In the case of an error, a value of -1 is returned instead. In addition to the usual file name errors, the following errno error conditions are defined for this function: EACCES: The file exists but is not readable/writable as requested by the flags argument, the file does not exist and the directory is not writable so it cannot be created. EEXIST: Both O_CREAT and O_EXCL are set, and the named file already exists. EINTR: The open operation was interrupted by a signal. EISDIR: The flags argument specified write access, and the file is a directory. EMFILE: The process has too many files open. ENFILE: The entire system, or perhaps the file system which contains the directory, cannot support any additional open files at the moment. (This problem cannot happen on the GNU system.) ENOENT: The named file does not exist, and O_CREAT is not specified. ENOSPC: The directory or file system that would contain the new file cannot be extended, because there is no disk space left. ENXIO: O_NONBLOCK and O_WRONLY are both set in the flags argument, the file named by filename is a FIFO, and no process has the file open for reading. EROFS: The file resides on a read-only file system and any of O_WRONLY, O_RDWR, and O_TRUNC are set in the flags argument, or O_CREAT is set and the file does not already exist. If on a 32 bit machine the sources are translated with _FILE_OFFSET_BITS == 64 the function open returns a file descriptor opened in the large file mode which enables the file handling functions to use files up to 2^63 bytes in size and offset from -2^63 to 2^63. This happens transparently for the user since all of the low level file handling functions are equally replaced. The header files you need to include are fcntl.h and io.h. The function open returns a file descriptor if successful, and a -1 on error. Example: df=open( MyFile.dat, O_RDWR); Note. The number of opened files is usually limited at any given moment File read T.U. Cluj-Napoca Computer Programming 3
4 To read from an existing file, previously opened using open use the function read. This has the following prototype: ssize_t read (int filedes, void *buffer, size_t size); where: ssize_t is defined as long (see include\sys\types.h) filedes - is a file descriptor as returned by open; buffer - is a pointer to the buffer memory area where the read record is stored; size - is the length in bytes of the record read. A file is viewed as a sequence of bytes starting with byte numbered zero After each read operation the file position indicator is advanced to indicate the byte for next read. EOF i End of file File position indicator When a file is opened with the flags O_RDONLY or O_RDWR, the file position indicator is positioned over byte 0 (beginning of file). The return value is the number of bytes actually read. This might be less than size; for example, if there aren't that many bytes left in the file or if there aren't that many bytes immediately available. The exact behavior depends on what kind of file it is. Note that reading less than size bytes is not an error. A value of zero indicates end-of-file (except if the value of the size argument is also zero). This is not considered an error. If you keep calling read while at end-of-file, it will keep returning zero and doing nothing else. If read returns at least one character, there is no way you can tell whether end-of-file was reached. But if you did reach the end, the next read will return zero. In case of an error, read returns -1. The standard input file (stdin) has a file descriptor zero. To use read you must include the header file io.h. Example. Read 20 bytes from the file MyFile.dat located in the current directory: df=open ( MyFile.dat, O_RDONLY); n=read (df, adr, 20); 2.4. File write To write to a file opened using open (or creat) use the function write. Its prototype is: ssize_t write (int filedes, const void *buffer, size_t size); The write function writes up to size bytes from buffer to the file with descriptor filedes. The data in buffer is not necessarily a character string and a null character is output like any other character. The return value is the number of bytes actually written or -1 in case of an error. This may be size, but can always be smaller. Your program should always call write in a loop, iterating until all the data is written. Once write returns, the data is enqueued to be written and can be read back right away, but it is not necessarily written out to permanent storage immediately. You can use fsync when you need to be sure your data has been permanently stored before continuing. (It is more efficient for the system T.U. Cluj-Napoca Computer Programming 4
5 to batch up consecutive writes and do them all at once when convenient. Normally they will always be written to disk within a minute or less.) The standard input file (stdout) has a file descriptor 1. To use write you must include the header file io.h. Example: Write in the file MyFile.dat located in the current directory 20 bytes from address adr: df=open ( MyFile.dat, O_WRONLY O_CREAT); n=write (df, adr, 20); 2.5. Positioning in a file Whne reading or writing starting with a certain position in a file is needed, use lseek. Its prototype is: off_t lseek (int filedes, off_t offset, int whence); The lseek function is used to change the file position of the file with descriptor filedes. The whence argument specifies how the offset should be interpreted, the same way as for the fseek function. It must be one of the symbolic constants SEEK_SET, SEEK_CUR, or SEEK_END. In detail: SEEK_SET specifies that whence is a count of characters from the beginning of the file. SEEK_CUR specifies that whence is a count of characters from the current file position. This count may be positive or negative. SEEK_END specifies that whence is a count of characters from the end of the file. A negative count specifies a position within the current extent of the file; a positive count specifies a position past the current end. If you set the position past the current end, and actually write data, you will extend the file with zeros up to that position. The return value from lseek is normally the resulting file position, measured in bytes from the beginning of the file or -1 in case an error occurs. You can use this feature together with SEEK_CUR to read the current file position. If you want to append to the file, setting the file position to the current end of file with SEEK_END is not sufficient. Another process may write more data after you seek but before you write, extending the file so the position you write onto clobbers their data. Instead, use the O_APPEND operating mode. To use lseek you must include the header file io.h. Examples: a) to position the indicator at the beginning of the file: lseek( filedes, 0l, SEEK_SET); b) to position the indicator at the end of the file: : lseek( filedes, 0l, SEEK_END); 2.6. Closing a file When done with the processing of a file, the file should be closed using the function close. int close(int filedes); where filedes is the file descriptor. The function returns zero upon success, and -1 if an error occurred. To use it, include io.h. T.U. Cluj-Napoca Computer Programming 5
6 2.7. Example The following program illustrates a number of operations on a file: - File creation. - Appending new records. - Modification of records. (In this case the file position indicator is set to the beginning of a record and the new record is written.) - File sort using the field media as a key. Because a large number of records were assumed to be stored in the file, first the records were read, and the record number and sort key were extracted from each record. This way ordering the keys can be achieved in the internal memory, as the data needed is less. Then the sorted file is obtained. /* Program L10Ex1.c */ #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <io.h> #include <ctype.h> #include <string.h> #include <sys/stat.h> typedef struct char name[60]; float media; StudentT; typedef union StudentT stud; char st[sizeof(studentt)]; BufferT; typedef struct int nb; float media; ElementT; typedef enum FALSE, TRUE BooleanT; void sort(const char filename[], const char sorted_filename[]) ElementT el, t[100]; char msgbuf[201]; int i, j, n, fd1, fd2; BooleanT flag; BufferT stu; /* read file to array t */ j = 0; fd1 = open(filename, O_RDONLY); while ( read(fd1, stu.st, sizeof(buffert)) > 0 && j < 100) t[j].nb = j; t[j].media = stu.stud.media; j++; T.U. Cluj-Napoca Computer Programming 6
7 n = j; /* sort array t by media */ j = 0; do flag = TRUE; for (i = 1; i < n - j ; i++) if (t[i-1].media < t[i].media) memcpy(&el, &t[i-1], sizeof(elementt)); memcpy(&t[i-1], &t[i], sizeof(elementt)); memcpy(&t[i], &el, sizeof(elementt)); flag = FALSE; while (flag == FALSE); /* write sorted output */ if ((fd2 = open(sorted_filename, O_CREAT O_WRONLY O_TRUNC, S_IREAD S_IWRITE)) < 0) sprintf(msgbuf, "\ncannot create %s. ", sorted_filename); perror(msgbuf); exit(1); for (i = 0; i < n; i++) lseek(fd1, (long)(t[i].nb *sizeof(buffert)), SEEK_SET); read(fd1, stu.st, sizeof(buffert)); write(fd2, stu.st, sizeof(buffert)); close(fd1); close(fd2); void show_students(char filename[]) BufferT stu; char s[41]; int j, fd1; if ((fd1 = open(filename, O_RDONLY)) < 0) sprintf(s, "Cannot open %s for reading. ", filename); perror(s); exit(3); memset(&stu, '\0', sizeof(buffert)); j = 0; while ( read(fd1, stu.st, sizeof(buffert)) > 0) printf("\n%d. %-60s %7.2f", j++, stu.stud.name, stu.stud.media); memset(&stu, '\0', sizeof(buffert)); close(fd1); int main(int argc, char *argv[]) T.U. Cluj-Napoca Computer Programming 7
8 unsigned int i, n; int fd1; long l; char ch; BufferT stu; float avgaux; char nameaux[sizeof(stu.stud.name)]; char filename[] = "Group.dat"; char sorted_filename[] = "SortedGroup.dat"; printf("\nnumber of students in the group= "); scanf("%u%*c", &n); /* create group file */ if ((fd1 = open(filename, O_CREAT O_WRONLY O_TRUNC, S_IREAD S_IWRITE)) < 0) perror("\ncannot create Group.dat. "); exit(1); /* student data input */ for (i = 1; i <= n; i++) printf("name: "); scanf("%s", stu.stud.name); printf("media: "); scanf("%f%*c", &stu.stud.media); if (write(fd1, stu.st, sizeof(buffert)) < sizeof(buffert)) perror("short write. "); exit(5); close(fd1); printf("\ngroup.dat contents after creation\n"); show_students(filename); /* add new records to file */ printf("\nnumber of students to add to group= "); scanf("%u%*c", &n); if ((fd1 = open(filename, O_RDWR)) < 0) perror("\ncannot append to Group.dat. "); exit(1); if (lseek(fd1, 0L, SEEK_END) < 0) perror("\nlseek to end failed. "); exit(4); /* student data input */ for (i = 1; i <= n; i++) printf("name: "); scanf("%s", stu.stud.name); printf("media: "); scanf("%f%*c", &stu.stud.media); T.U. Cluj-Napoca Computer Programming 8
9 write(fd1, stu.st, sizeof(buffert)); close(fd1); printf("\ngroup.dat contents after addition\n"); show_students(filename); printf("\nupdate student info [Yes=Y/y, No=other char]? "); ch= fd1 = open(filename, O_RDWR); while( toupper(ch) == 'Y') printf("\nstudent number= "); scanf("%d%*c", &i); l = lseek(fd1, (long)(i * sizeof(buffert)), SEEK_SET); printf("\toffset=%ld for i=%d\n", l, i); read(fd1, stu.st, sizeof(buffert)); printf("current name is: %s\nnew name: ", stu.stud.name); scanf("%s", nameaux); if (*nameaux) strcpy(stu.stud.name, nameaux); printf("current media is: %f\nnew media: ", stu.stud.media); scanf("%f", &avgaux); if (avgaux > 0) stu.stud.media = avgaux; l = lseek(fd1, (long)(i * sizeof(buffert)), SEEK_SET); printf("\toffset=%ld for i=%d\n", l, i); write(fd1, stu.st, sizeof(buffert)); printf("\nupdate more student info [Yes=Y/y, No=other char]? "); scanf("%*c%c", &ch); close(fd1); printf("\ngroup.dat contents after changes\n"); show_students(filename); sort(filename, sorted_filename); printf("\ngroup sorted by media\n"); show_students(sorted_filename); return 0; 3. Lab Tasks 3.1. Execute and analyze the example program, L10Ex1.cpp 3.2. Read from the standard input a text, and write it to a text file, e.g. file text.dat. Then display the file contents, prefixing each line with its order number Read the real part and imaginary part of n complex numbers. Then create a file containing the complex numbers your program read including the real part, the imaginary part, the modulus and argument for each number Two companies maintain information concerning their stocks (product code, name, amount, price per unit) in the files "stock1.dat" and "stock2.dat" respectively, ordered ascending by product code. The two companies merge, and there results a common stock which must be stored in the file "stock.dat", again ordered by the product code. a) Create the original files input data from the keyboard, and then create the merged file "stock.dat". For products of the same code consider that the name and unit price are identical in both companies. b) Walk sequentially through the file "stock.dat", and print for each product its name and amount. T.U. Cluj-Napoca Computer Programming 9
10 c) For a component selected by the order number change the price per unit directly Write a program to concatenate two or more files containing real numbers. Print the information stored in the resulted file A simple message compression method is the following (run-length): any sequence of more than three identical characters is replaced by the following triple: - A control character (marker); - The repeated character; - A natural number indicating the number of repetitions of that character. For example, the sequence uuuuuu becomes #u6 (the control character was chosen to be #) Note there are some issues here: - The choice of the control character and its representation if it occurs in the message. - The maximum number of repetitions which can be represented by a single triple Write a program to compress/decompress a file using functions for these operations. The name of the file to process must be passed as a parameter. Analyze the efficiency of compression by comparing the contents of the original with the compressed version Write a program to accomplish the following actions: - Create a file with data concerning cars in a garage. A car is represented by a structure containing its brand name, owner name, color and number (from the number plate). - Display on the screen an alphabetic list of all cars of a given color, ordered by owner s name Write a program which should read a C source text file and prints the occurrence frequencies for the reserved keywords in the given text Write a program which compares the contents of two existing text files an prints the lines which are different. T.U. Cluj-Napoca Computer Programming 10
System Calls Related to File Manipulation
KING FAHD UNIVERSITY OF PETROLEUM AND MINERALS Information and Computer Science Department ICS 431 Operating Systems Lab # 12 System Calls Related to File Manipulation Objective: In this lab we will be
Lecture 24 Systems Programming in C
Lecture 24 Systems Programming in C A process is a currently executing instance of a program. All programs by default execute in the user mode. A C program can invoke UNIX system calls directly. A system
System Calls and Standard I/O
System Calls and Standard I/O Professor Jennifer Rexford http://www.cs.princeton.edu/~jrex 1 Goals of Today s Class System calls o How a user process contacts the Operating System o For advanced services
Linux/UNIX System Programming. POSIX Shared Memory. Michael Kerrisk, man7.org c 2015. February 2015
Linux/UNIX System Programming POSIX Shared Memory Michael Kerrisk, man7.org c 2015 February 2015 Outline 22 POSIX Shared Memory 22-1 22.1 Overview 22-3 22.2 Creating and opening shared memory objects 22-10
Unix System Calls. Dept. CSIE 2006.12.25
Unix System Calls Gwan-Hwan Hwang Dept. CSIE National Taiwan Normal University 2006.12.25 UNIX System Overview UNIX Architecture Login Name Shells Files and Directories File System Filename Pathname Working
Module 816. File Management in C. M. Campbell 1993 Deakin University
M. Campbell 1993 Deakin University Aim Learning objectives Content After working through this module you should be able to create C programs that create an use both text and binary files. After working
Lecture 17. Process Management. Process Management. Process Management. Inter-Process Communication. Inter-Process Communication
Process Management Lecture 17 Review February 25, 2005 Program? Process? Thread? Disadvantages, advantages of threads? How do you identify processes? How do you fork a child process, the child process
Illustration 1: Diagram of program function and data flow
The contract called for creation of a random access database of plumbing shops within the near perimeter of FIU Engineering school. The database features a rating number from 1-10 to offer a guideline
Shared Memory Introduction
12 Shared Memory Introduction 12.1 Introduction Shared memory is the fastest form of IPC available. Once the memory is mapped into the address space of the processes that are sharing the memory region,
Operating Systems. Privileged Instructions
Operating Systems Operating systems manage processes and resources Processes are executing instances of programs may be the same or different programs process 1 code data process 2 code data process 3
OS: IPC I. Cooperating Processes. CIT 595 Spring 2010. Message Passing vs. Shared Memory. Message Passing: Unix Pipes
Cooperating Processes Independent processes cannot affect or be affected by the execution of another process OS: IPC I CIT 595 Spring 2010 Cooperating process can affect or be affected by the execution
/* File: blkcopy.c. size_t n
13.1. BLOCK INPUT/OUTPUT 505 /* File: blkcopy.c The program uses block I/O to copy a file. */ #include main() { signed char buf[100] const void *ptr = (void *) buf FILE *input, *output size_t
Programmation Systèmes Cours 7 IPC: FIFO
Programmation Systèmes Cours 7 IPC: FIFO Stefano Zacchiroli [email protected] Laboratoire PPS, Université Paris Diderot - Paris 7 15 novembre 2011 URL http://upsilon.cc/zack/teaching/1112/progsyst/ Copyright
Giving credit where credit is due
JDEP 284H Foundations of Computer Systems System-Level I/O Dr. Steve Goddard [email protected] Giving credit where credit is due Most of slides for this lecture are based on slides created by Drs. Bryant
Lab 4: Socket Programming: netcat part
Lab 4: Socket Programming: netcat part Overview The goal of this lab is to familiarize yourself with application level programming with sockets, specifically stream or TCP sockets, by implementing a client/server
Informatica e Sistemi in Tempo Reale
Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)
Sources: On the Web: Slides will be available on:
C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,
The C Programming Language course syllabus associate level
TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming
Fast Arithmetic Coding (FastAC) Implementations
Fast Arithmetic Coding (FastAC) Implementations Amir Said 1 Introduction This document describes our fast implementations of arithmetic coding, which achieve optimal compression and higher throughput by
Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine
7 Objectives After completing this lab you will: know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine Introduction Branches and jumps provide ways to change
How To Port A Program To Dynamic C (C) (C-Based) (Program) (For A Non Portable Program) (Un Portable) (Permanent) (Non Portable) C-Based (Programs) (Powerpoint)
TN203 Porting a Program to Dynamic C Introduction Dynamic C has a number of improvements and differences compared to many other C compiler systems. This application note gives instructions and suggestions
Lecture 16: System-Level I/O
CSCI-UA.0201-003 Computer Systems Organization Lecture 16: System-Level I/O Mohamed Zahran (aka Z) [email protected] http://www.mzahran.com Some slides adapted (and slightly modified) from: Clark Barrett
ASCII Encoding. The char Type. Manipulating Characters. Manipulating Characters
The char Type ASCII Encoding The C char type stores small integers. It is usually 8 bits. char variables guaranteed to be able to hold integers 0.. +127. char variables mostly used to store characters
Jorix kernel: real-time scheduling
Jorix kernel: real-time scheduling Joris Huizer Kwie Min Wong May 16, 2007 1 Introduction As a specialized part of the kernel, we implemented two real-time scheduling algorithms: RM (rate monotonic) and
NDK: NOVELL NSS AUDIT
www.novell.com/documentation NDK: NOVELL NSS AUDIT Developer Kit August 2015 Legal Notices Novell, Inc., makes no representations or warranties with respect to the contents or use of this documentation,
Chapter I/O and File System
Chapter 11 I/O and File System Tornado Training Workshop Copyright 11-1 ntroduction to VxWorks I/O System haracter I/O lock I/O I/O System 11.1 Introduction Character I/O Block I/O Tornado Training Workshop
Shared Memory Segments and POSIX Semaphores 1
Shared Memory Segments and POSIX Semaphores 1 Alex Delis delis -at+ pitt.edu October 2012 1 Acknowledgements to Prof. T. Stamatopoulos, M. Avidor, Prof. A. Deligiannakis, S. Evangelatos, Dr. V. Kanitkar
Lecture 3. Arrays. Name of array. c[0] c[1] c[2] c[3] c[4] c[5] c[6] c[7] c[8] c[9] c[10] c[11] Position number of the element within array c
Lecture 3 Data structures arrays structs C strings: array of chars Arrays as parameters to functions Multiple subscripted arrays Structs as parameters to functions Default arguments Inline functions Redirection
µtasker Document FTP Client
Embedding it better... µtasker Document FTP Client utaskerftp_client.doc/1.01 Copyright 2012 M.J.Butcher Consulting Table of Contents 1. Introduction...3 2. FTP Log-In...4 3. FTP Operation Modes...4 4.
Programming languages C
INTERNATIONAL STANDARD ISO/IEC 9899:1999 TECHNICAL CORRIGENDUM 2 Published 2004-11-15 INTERNATIONAL ORGANIZATION FOR STANDARDIZATION МЕЖДУНАРОДНАЯ ОРГАНИЗАЦИЯ ПО СТАНДАРТИЗАЦИИ ORGANISATION INTERNATIONALE
COSC 6397 Big Data Analytics. Distributed File Systems (II) Edgar Gabriel Spring 2014. HDFS Basics
COSC 6397 Big Data Analytics Distributed File Systems (II) Edgar Gabriel Spring 2014 HDFS Basics An open-source implementation of Google File System Assume that node failure rate is high Assumes a small
Sensors and the Zaurus S Hardware
The Zaurus Software Development Guide Robert Christy August 29, 2003 Contents 1 Overview 1 2 Writing Software for the Zaurus 2 3 Using the bathw Library 3 3.1 Using the fans.............................
System calls. Problem: How to access resources other than CPU
System calls Problem: How to access resources other than CPU - Disk, network, terminal, other processes - CPU prohibits instructions that would access devices - Only privileged OS kernel can access devices
Caml Virtual Machine File & data formats Document version: 1.4 http://cadmium.x9c.fr
Caml Virtual Machine File & data formats Document version: 1.4 http://cadmium.x9c.fr Copyright c 2007-2010 Xavier Clerc [email protected] Released under the LGPL version 3 February 6, 2010 Abstract: This
C++ Programming Language
C++ Programming Language Lecturer: Yuri Nefedov 7th and 8th semesters Lectures: 34 hours (7th semester); 32 hours (8th semester). Seminars: 34 hours (7th semester); 32 hours (8th semester). Course abstract
El Dorado Union High School District Educational Services
El Dorado Union High School District Course of Study Information Page Course Title: ACE Computer Programming II (#495) Rationale: A continuum of courses, including advanced classes in technology is needed.
1. Introduction to the UNIX File System: logical vision
Unix File System 1. Introduction to the UNIX File System: logical vision Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7 th Edition, Feb 6, 2005 Logical structure in each FS (System V):
Basics of I/O Streams and File I/O
Basics of This is like a cheat sheet for file I/O in C++. It summarizes the steps you must take to do basic I/O to and from files, with only a tiny bit of explanation. It is not a replacement for reading
File Handling. What is a file?
File Handling 1 What is a file? A named collection of data, stored in secondary storage (typically). Typical operations on files: Open Read Write Close How is a file stored? Stored as sequence of bytes,
Introduction. dnotify
Introduction In a multi-user, multi-process operating system, files are continually being created, modified and deleted, often by apparently unrelated processes. This means that any software that needs
KITES TECHNOLOGY COURSE MODULE (C, C++, DS)
KITES TECHNOLOGY 360 Degree Solution www.kitestechnology.com/academy.php [email protected] [email protected] Contact: - 8961334776 9433759247 9830639522.NET JAVA WEB DESIGN PHP SQL, PL/SQL
Lab 2 : Basic File Server. Introduction
Lab 2 : Basic File Server Introduction In this lab, you will start your file system implementation by getting the following FUSE operations to work: CREATE/MKNOD, LOOKUP, and READDIR SETATTR, WRITE and
Building a Multi-Threaded Web Server
Building a Multi-Threaded Web Server In this lab we will develop a Web server in two steps. In the end, you will have built a multi-threaded Web server that is capable of processing multiple simultaneous
As previously noted, a byte can contain a numeric value in the range 0-255. Computers don't understand Latin, Cyrillic, Hindi, Arabic character sets!
Encoding of alphanumeric and special characters As previously noted, a byte can contain a numeric value in the range 0-255. Computers don't understand Latin, Cyrillic, Hindi, Arabic character sets! Alphanumeric
1 Abstract Data Types Information Hiding
1 1 Abstract Data Types Information Hiding 1.1 Data Types Data types are an integral part of every programming language. ANSI-C has int, double and char to name just a few. Programmers are rarely content
C Programming. for Embedded Microcontrollers. Warwick A. Smith. Postbus 11. Elektor International Media BV. 6114ZG Susteren The Netherlands
C Programming for Embedded Microcontrollers Warwick A. Smith Elektor International Media BV Postbus 11 6114ZG Susteren The Netherlands 3 the Table of Contents Introduction 11 Target Audience 11 What is
1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++
Answer the following 1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ 2) Which data structure is needed to convert infix notations to postfix notations? Stack 3) The
Device Management API for Windows* and Linux* Operating Systems
Device Management API for Windows* and Linux* Operating Systems Library Reference September 2004 05-2222-002 INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS. NO LICENSE, EXPRESS
Application Note. Introduction AN2471/D 3/2003. PC Master Software Communication Protocol Specification
Application Note 3/2003 PC Master Software Communication Protocol Specification By Pavel Kania and Michal Hanak S 3 L Applications Engineerings MCSL Roznov pod Radhostem Introduction The purpose of this
7th Marathon of Parallel Programming WSCAD-SSC/SBAC-PAD-2012
7th Marathon of Parallel Programming WSCAD-SSC/SBAC-PAD-2012 October 17 th, 2012. Rules For all problems, read carefully the input and output session. For all problems, a sequential implementation is given,
Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY. 6.828 Operating System Engineering: Fall 2005
Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.828 Operating System Engineering: Fall 2005 Quiz II Solutions Average 84, median 83, standard deviation
Networks. Inter-process Communication. Pipes. Inter-process Communication
Networks Mechanism by which two processes exchange information and coordinate activities Inter-process Communication process CS 217 process Network 1 2 Inter-process Communication Sockets o Processes can
1 Posix API vs Windows API
1 Posix API vs Windows API 1.1 File I/O Using the Posix API, to open a file, you use open(filename, flags, more optional flags). If the O CREAT flag is passed, the file will be created if it doesnt exist.
File Management. Chapter 12
Chapter 12 File Management File is the basic element of most of the applications, since the input to an application, as well as its output, is usually a file. They also typically outlive the execution
Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C
Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection
Linux Driver Devices. Why, When, Which, How?
Bertrand Mermet Sylvain Ract Linux Driver Devices. Why, When, Which, How? Since its creation in the early 1990 s Linux has been installed on millions of computers or embedded systems. These systems may
The programming language C. sws1 1
The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan
Device Management API for Windows* and Linux* Operating Systems
Device Management API for Windows* and Linux* Operating Systems Library Reference August 2005 05-2222-003 INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS. NO LICENSE, EXPRESS
Database 2 Lecture I. Alessandro Artale
Free University of Bolzano Database 2. Lecture I, 2003/2004 A.Artale (1) Database 2 Lecture I Alessandro Artale Faculty of Computer Science Free University of Bolzano Room: 221 [email protected] http://www.inf.unibz.it/
Leak Check Version 2.1 for Linux TM
Leak Check Version 2.1 for Linux TM User s Guide Including Leak Analyzer For x86 Servers Document Number DLC20-L-021-1 Copyright 2003-2009 Dynamic Memory Solutions LLC www.dynamic-memory.com Notices Information
Number Representation
Number Representation CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Topics to be Discussed How are numeric data
The following themes form the major topics of this chapter: The terms and concepts related to trees (Section 5.2).
CHAPTER 5 The Tree Data Model There are many situations in which information has a hierarchical or nested structure like that found in family trees or organization charts. The abstraction that models hierarchical
64 Bit File Access. 1.0 Introduction. 2.0 New Interfaces. 2.1 New User Visible Types. Adam Sweeney
64 Bit File Access Adam Sweeney 1.0 Introduction In order to support the access of 64 bit files from 32 bit applications, new interfaces must be defined which take 64 bit parameters. These interfaces must
UNIX Sockets. COS 461 Precept 1
UNIX Sockets COS 461 Precept 1 Clients and Servers Client program Running on end host Requests service E.g., Web browser Server program Running on end host Provides service E.g., Web server GET /index.html
PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?
1. Distinguish & and && operators. PART-A Questions 2. How does an enumerated statement differ from a typedef statement? 3. What are the various members of a class? 4. Who can access the protected members
Binary storage of graphs and related data
EÖTVÖS LORÁND UNIVERSITY Faculty of Informatics Department of Algorithms and their Applications Binary storage of graphs and related data BSc thesis Author: Frantisek Csajka full-time student Informatics
A Catalogue of the Steiner Triple Systems of Order 19
A Catalogue of the Steiner Triple Systems of Order 19 Petteri Kaski 1, Patric R. J. Östergård 2, Olli Pottonen 2, and Lasse Kiviluoto 3 1 Helsinki Institute for Information Technology HIIT University of
Grundlagen der Betriebssystemprogrammierung
Grundlagen der Betriebssystemprogrammierung Präsentation A3, A4, A5, A6 21. März 2013 IAIK Grundlagen der Betriebssystemprogrammierung 1 / 73 1 A3 - Function Pointers 2 A4 - C++: The good, the bad and
So far we have considered only numeric processing, i.e. processing of numeric data represented
Chapter 4 Processing Character Data So far we have considered only numeric processing, i.e. processing of numeric data represented as integer and oating point types. Humans also use computers to manipulate
Glossary of Object Oriented Terms
Appendix E Glossary of Object Oriented Terms abstract class: A class primarily intended to define an instance, but can not be instantiated without additional methods. abstract data type: An abstraction
NS3 Lab 1 TCP/IP Network Programming in C
NS3 Lab 1 TCP/IP Network Programming in C Dr Colin Perkins School of Computing Science University of Glasgow http://csperkins.org/teaching/ns3/ 13/14 January 2015 Introduction The laboratory exercises
Xillybus host application programming guide for Linux
Xillybus host application programming guide for Linux Xillybus Ltd. Version 2.0 1 Introduction 3 2 Synchronous vs. asynchronous streams 5 2.1 Overview................................... 5 2.2 Motivation
Network Programming with Sockets. Anatomy of an Internet Connection
Network Programming with Sockets Anatomy of an Internet Connection Client socket address 128.2.194.242:51213 socket address 208.216.181.15:80 Client Connection socket pair (128.2.194.242:51213, 208.216.181.15:80)
Fortify on Demand Security Review. Fortify Open Review
Fortify on Demand Security Review Company: Project: Version: Latest Analysis: Fortify Open Review GNU m4 1.4.17 4/17/2015 12:16:24 PM Executive Summary Company: Project: Version: Static Analysis Date:
2- Electronic Mail (SMTP), File Transfer (FTP), & Remote Logging (TELNET)
2- Electronic Mail (SMTP), File Transfer (FTP), & Remote Logging (TELNET) There are three popular applications for exchanging information. Electronic mail exchanges information between people and file
Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void
1. Explain C tokens Tokens are basic building blocks of a C program. A token is the smallest element of a C program that is meaningful to the compiler. The C compiler recognizes the following kinds of
The Linux Virtual Filesystem
Lecture Overview Linux filesystem Linux virtual filesystem (VFS) overview Common file model Superblock, inode, file, dentry Object-oriented Ext2 filesystem Disk data structures Superblock, block group,
Java Interview Questions and Answers
1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write and compile the java
Object Oriented Software Design
Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 28, 2010 G. Lipari (Scuola Superiore Sant Anna) Introduction
Tutorial on C Language Programming
Tutorial on C Language Programming Teodor Rus [email protected] The University of Iowa, Department of Computer Science Introduction to System Software p.1/64 Tutorial on C programming C program structure:
Operating System Structure
Operating System Structure Lecture 3 Disclaimer: some slides are adopted from the book authors slides with permission Recap Computer architecture CPU, memory, disk, I/O devices Memory hierarchy Architectural
Virtuozzo Virtualization SDK
Virtuozzo Virtualization SDK Programmer's Guide February 18, 2016 Copyright 1999-2016 Parallels IP Holdings GmbH and its affiliates. All rights reserved. Parallels IP Holdings GmbH Vordergasse 59 8200
COS 318: Operating Systems. File Layout and Directories. Topics. File System Components. Steps to Open A File
Topics COS 318: Operating Systems File Layout and Directories File system structure Disk allocation and i-nodes Directory and link implementations Physical layout for performance 2 File System Components
The Windows Shortcut File Format as reverse-engineered by Jesse Hager [email protected] Document Version 1.0
Disclaimer The Windows Shortcut File Format as reverse-engineered by Jesse Hager [email protected] Document Version 1.0 This document is provided AS-IS basis, without any warranties or representations
Forensic Analysis of Internet Explorer Activity Files
Forensic Analysis of Internet Explorer Activity Files by Keith J. Jones [email protected] 3/19/03 Table of Contents 1. Introduction 4 2. The Index.dat File Header 6 3. The HASH Table 10 4. The
UNIX File Management (continued)
UNIX File Management (continued) OS storage stack (recap) Application FD table OF table VFS FS Buffer cache Disk scheduler Device driver 2 Virtual File System (VFS) Application FD table OF table VFS FS
60-141 Introduction to Programming II Winter, 2014 Assignment 2
60-141 Introduction to Programming II Winter, 2014 Assignment 2 Array In this assignment you will implement an encryption and a corresponding decryption algorithm which involves only random shuffling of
Operating Systems and Networks
recap Operating Systems and Networks How OS manages multiple tasks Virtual memory Brief Linux demo Lecture 04: Introduction to OS-part 3 Behzad Bordbar 47 48 Contents Dual mode API to wrap system calls
TFTP Usage and Design. Diskless Workstation Booting 1. TFTP Usage and Design (cont.) CSCE 515: Computer Network Programming ------ TFTP + Errors
CSCE 515: Computer Network Programming ------ TFTP + Errors Wenyuan Xu Department of Computer Science and Engineering University of South Carolina TFTP Usage and Design RFC 783, 1350 Transfer files between
2 ASCII TABLE (DOS) 3 ASCII TABLE (Window)
1 ASCII TABLE 2 ASCII TABLE (DOS) 3 ASCII TABLE (Window) 4 Keyboard Codes The Diagram below shows the codes that are returned when a key is pressed. For example, pressing a would return 0x61. If it is
public static void main(string[] args) { System.out.println("hello, world"); } }
Java in 21 minutes hello world basic data types classes & objects program structure constructors garbage collection I/O exceptions Strings Hello world import java.io.*; public class hello { public static
Object Oriented Software Design
Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa September 14, 2011 G. Lipari (Scuola Superiore Sant Anna) Introduction
Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C
Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C 1 An essential part of any embedded system design Programming 2 Programming in Assembly or HLL Processor and memory-sensitive
Member Functions of the istream Class
Member Functions of the istream Class The extraction operator is of limited use because it always uses whitespace to delimit its reads of the input stream. It cannot be used to read those whitespace characters,
ALLIED PAPER : DISCRETE MATHEMATICS (for B.Sc. Computer Technology & B.Sc. Multimedia and Web Technology)
ALLIED PAPER : DISCRETE MATHEMATICS (for B.Sc. Computer Technology & B.Sc. Multimedia and Web Technology) Subject Description: This subject deals with discrete structures like set theory, mathematical
Logging. Working with the POCO logging framework.
Logging Working with the POCO logging framework. Overview > Messages, Loggers and Channels > Formatting > Performance Considerations Logging Architecture Message Logger Channel Log File Logging Architecture
How To Write Portable Programs In C
Writing Portable Programs COS 217 1 Goals of Today s Class Writing portable programs in C Sources of heterogeneity Data types, evaluation order, byte order, char set, Reading period and final exam Important
TivaWare Utilities Library
TivaWare Utilities Library USER S GUIDE SW-TM4C-UTILS-UG-1.1 Copyright 2013 Texas Instruments Incorporated Copyright Copyright 2013 Texas Instruments Incorporated. All rights reserved. Tiva and TivaWare
