Free Essay

Project to Simulate the Behaviour of Move Command and Develop a New Command That Does the Work.

In: Science

Submitted By alaska
Words 815
Pages 4
LINUX PROGRAMMING
MINI PROJECT
ON

PROJECT TO SIMULATE THE BEHAVIOUR OF MOVE COMMAND AND DEVELOP A NEW COMMAND THAT DOES THE WORK.

SUBMITTED BY: SHOBHIT MATHEW (RK2102B22) (11104723)

ACKNOWLEDGEMENT
We got help from many people during the course of this project. We would specially like to thank our Linux programming teacher Ms. Sheena Singh who helped us to complete this project. We would like to thank some of our colleagues who helped us to complete this project. Without their help and support it would not be possible for us to complete this project.

CONTENTS TOPICS
INTRODUCTION System Calls Command line Argument Program Bibliography

PAGE NO.
4 4 5 6 10

INTRODUCTION
In this program various operations are performed using move command like moving half of the content from one file to another, move the complete information from one file to another, append the file using move command etc. by using system call in linux.

MOVE COMMAND
This command will move the content of one file to another and delete the first file.

SYSTEM CALLS
Various system calls used are:• OPEN system call:- it will help in opening a new file. Syntax:- fd=open(“const-char-pathname”, flag, mode); • READ system call:- to read the contents from a file. Syntax:- read(fd, buff, size_count); • WRITE system call:- it is used to write some content into the file. Syntax:- write fd,&buffer address,size_count);

• LSEEK system call:- to move the curser in the file Syntax:- lseek(fd, offset, whence); • REMOVE system call:- to delete a particular file Syntax:- rm(“filename”);

COMMAND LINE ARGUMENT
The arguments which are passed during the run time are called command line arguments. In this GETOPT function is used. Inside main we are using it as: • Int main(int argc, char *argv[]) • Syntax:- int getopt(int argc, char *argv[], const char *optstring); extern char *optarg; extern int optind, opterr, optopt; • If the option takes a value that value is pointed by the external variable optarg. • Getopt returns -1 when there are no more options to process. • Getopt returns ? if there is an unrecognized option,which it stores in external variable optopt. • The external variable optind is set to the index of the next argument to process.

PROGRAMMING
#include #include #include #include #include #include #include #include int main() { int option,fd,n,x,fd2,m,y; char buff[1000]; printf("press 1 to move half of the content of file \n"); printf("press 2 to move complete content from 1 file 2 another \n"); printf("press 3 to append the file \n"); scanf("%d",&option); switch(option) { case 1: {

fd=open("f11.txt",O_CREAT|O_RDWR); //creat a new file in //read write mode n=write(fd,"hi this is pratik",17); //write into the file n=read(fd,"hi this is pratik",17); printf("content of first file is \n"); write(1,"hi this is pratik",17); x=lseek(fd,-12,SEEK_END); //move the curser into the file fd2=open("f12.txt",O_CREAT|O_RDWR); m=write(fd2,"hi this is pratik",x); printf("\ncontent of 2nd file is \n"); write(1,"hi this is pratik",7); close(fd); close(fd2); break; }

case 2: {

fd=open("f11.txt",O_CREAT|O_RDWR); //creat a new file in //read write mode n=write(fd,"hi this is pratik",17); //write into the file n=read(fd,"hi this is pratik",17); printf("content of first file is \n"); write(1,"hi this is pratik",17); x=lseek(fd,-17,SEEK_END); //move the curser into the file

fd2=open("f12.txt",O_CREAT|O_RDWR); m=write(fd2,"hi this is pratik",x); printf("\ncontent of 2nd file is \n"); write(1,"hi this is pratik",17);

remove("f11.txt"); //delete the first file printf("\n file one is deleted \n"); printf("the content of file one is \n"); write(1,buff,n); close(fd);

close(fd2); break; } case 3: {

fd=open("f11.txt",O_CREAT|O_RDWR); //creat a new file in //read write mode n=write(fd,"hi this is pratik",17); //write into the file n=read(fd,"hi this is pratik",17); printf("content of first file is \n"); write(1,"hi this is pratik",17); x=lseek(fd,-17,SEEK_END); //move the curser into the file fd2=open("f12.txt",O_CREAT|O_RDWR); m=write(fd2,"hi this is pratik",x);

printf("\ncontent of 2nd file is \n"); write(1,"hi this is pratik",17); remove("f11.txt"); //delete the first file printf("the content of file one is \n"); write(1,buff,n); printf("\n file one is deleted \n"); lseek(fd2,17,SEEK_SET); y=write(fd2,"this is the new content",23); printf("new content of 2nd file is\n"); write(1,"hi this is pratik",17); write(1," this is the new content\n",24);

close(fd); close(fd2); break; }

}

return 0; }

BIBLIOGRAPHY
• Beginning linux programming • www.1000projects.com • www.slideworld.com • www.wikipedia.org

Similar Documents

Free Essay

System Analysis

...to HCI Humans 2. Human Cognition 3. Perception and Representation 4. Attention and Memory 5. Knowledge and Mental Models 6. Interface metaphors Interactions 7. Input 8. Output 9. User Support 10. Interaction Styles 11. Information Architecture and Web Navigation User-Centred Design 12. User-Centred Design 13. Methods for User-Centred Design 14. User-Centred Web Design 15. Usability Engineering 16. Guidelines and Standards 17. Prototyping 18. Evaluation 1 Computer Supported Cooperative Work Cooperative working Classification of CSCW systems Groupware Systems Organization contributions. Applications of multimedia systems in learning, computer vision, and entertainment. 2 BIT 2305: HUMAN COMPUTER INTERACTION INTRODUCTION TO HCI Human Computer Interaction (HCI) is concerned with studying ways to design, prototype, evaluate and implement user interfaces that are easy to learn, efficient and pleasant to use. Often it is hard to learn a new tool. This is particularly the case in the complicated world of the computer where there are many different technologies (software tools) and many different ways to access them (different hardware and different screen layouts). Bridging the gap between the technology and the user – making the technology easy to learn and easy to use – is concern and the task of the “user interface”. User refers to the different people who might be using a certain tool. In these times of wide software distribution, there...

Words: 15860 - Pages: 64

Premium Essay

Business

...(for use in the classroom only) ISSUES RELATING TO ADULT LEARNING Learning is the basic objective of all the training and development activities. If people have not learnt what they were suppose to learn from a HRD program; then the program should be called as a failure. It is, therefore, very important for HRD professionals to understand the major concepts and research findings related to learning. Learning may be defined as the process of acquiring, assimilating, and internalizing inputs for their effective and varied use when required, leading to an enhanced capability for further self monitored learning. It is any relatively permanent change in behaviour that occurs as a result of experience. The change often is an increased capability for some type of performance. Basic learning styles of the participants Every individual has a unique way of gathering, absorbing, processing and internalizing inputs for learning purpose. This constitutes an individual’s learning style. It must, however, be remembered that the learning style of an individual is neither always explicit nor enduring. An individual modifies it in light of the situations and experiences. Even in a training program, a participant may change the learning style, depending on the opportunities available for learning. It may be noted that a participant's learning style is not necessarily a measure of his/her intellect and learning abilities. It only suggests a preference for the manner in which...

Words: 3683 - Pages: 15

Premium Essay

Principal & Practice of Management

...research-oriented-business-acumen and the competitive managerial excellence in successfully tackling the new emerging management-related-problems of the country in the changing global scenario. Individuals who look upon education as a continuing activity and wish to enhance their knowledge in an existing discipline or acquire proficiency in a new area are sure to benefit from the offered Programs. Distance Education is an attempt to make education accessible beyond the close confines of a classroom and to make it available to those who aspire and endeavor. The pedagogy used is interactive with cutting-edge techniques and innovation. This has gone long way to strengthen skills and expertise students to meet much-needed requirement of management students; in industry or society. The Institute pioneered and offers more than 40 programs in the field of Management, Computer, Six Sigma and SAP Training certification courses. We emphasis on imparting education to various genres of the society, right from Students to Professionals and Housewives to Businessmen. At IIBM we deal in keeping this flow up and building the management education in a way that is relevant, contextual and motivating the managers from all sectors i.e. corporate and non-corporate. We continue to strive for excellence by utilizing technology to create a regional community of learners and providing leadership in developing a model educational program for the new millennium. SYLLABUS Principles and Practices of Management ( IIBM...

Words: 125380 - Pages: 502

Free Essay

Lokjmhnbvc

...NODE Chapter 12: Beyond web servers Chapter 13: The Node ecosystem APPENDIXES Appendix A: Installing Node and community add-ons Appendix B: Debugging Node ©Manning Publications Co. Please post comments or corrections to the Author Online forum: http://www.manning-sandbox.com/forum.jspa?forumID=790 Licensed to Roger Chen 1 Welcome to Node.js 1 This chapter covers: What Node.js is JavaScript on the server Asyncronous and evented nature of Node Types of applications Node is designed for Sample Node programs So what is Node.js? It’s likely you have heard the term. Maybe you use Node. Maybe you are curious about it. At this point in time, Node is very popular and young (it debuted in 20091). It is the second most watched project on GitHub2, has quite a following in its Google group3 and IRC channel4 and has more than 15,000 community modules published in NPM (the package manager)5. All this to say, there is considerable traction behind this platform. Footnote 1mFirst...

Words: 105776 - Pages: 424

Premium Essay

Management

...Subject: Management Concepts and Organizational Behaviour Subject: Management Concepts and Organizational Behaviour ------------------------------------------------- Subject Code: MC-101 Author: Dr. Karam Pal ------------------------------------------------- Lesson No: 01 Vetter: Prof. Harbhajan Bansal ------------------------------------------------- Subject Code: MC-101 Author: Dr. Karam Pal ------------------------------------------------- Lesson No: 01 Vetter: Prof. Harbhajan Bansal INTRODUCTION TO MANAGEMENT Objective: The objectives of this lesson are to enable to define management; to describe the nature and scope of management; to know the difference between management and administration; to understand various levels of management; and to describe the various skills that are necessary for successful managers. Lesson Structure: 1.1 Introduction 1.2 Definition of Management 1.3 Characteristics of Management 1.4 Management Functions/ the Process of Management 1.5 N ature of Management 1.6 Management Vs. Administration 1.7 Levels of Management 1.8 Managerial Skills 1.9 The Manager and his job 1.10 Principles of Management 1.11 Significance of Management 1.12 Summary 1.13 Self Assessment Questions 1.14 Suggested Readings 1.1 INTRODUCTION A business develops in course of time with complexities. With increasing complexities managing the business has become a difficult...

Words: 50220 - Pages: 201

Premium Essay

Management Module

...aCHAPTER 1 BUSINESS ORGANISATIONS At the end of this Module the student shall be able to: Understand the various types of business organisations that can be established. Appreciate the advantages and disadvantages of each type of business Introduction A business activity is any legal activity that may be owned by one person as a sole proprietor or can be owned jointly by two or more people thereby creating a partnership. The main aim of many business operations is to make a profit either in the short or long term. A business activity is not only trading activities like the popular Kantemba business that have spread along many high ways in cities and towns. A business may be in the form of manufacturing something for sale, buying and selling for profit, providing services etc. Some examples of businesses include banking, insurance, retail trade, producing beer, providing educational services, Shoprite Chain Stores, Game stores, Internet services, tourist lodge or hotel, transport services etc. Element 1.1 Types of Business Enterprises A business may be owned by one person as a sole proprietor or can be owned jointly with another person or partner as a partnership. Another way in which a business could be owned is through the establishment of a limited liability company. A limited liability company can be privately or publicly owned. Another form of business organization could be through a cooperative society. The government may on behalf of the entire citizenry own businesses...

Words: 31725 - Pages: 127

Free Essay

Spcc

...Table of Contents 1. Acknowledgement 3 2. Introduction 4 2.1 Smart Home Control System 4 2.2 LabVIEW 5 3. Project Requirement 6 3.1 Project Requirement fulfilled by using LabVIEW 6 3.2 Why should I Use LabVIEW? 7 3.3 How does LabVIEW work? 8 3.3.1 Front Panel 8 3.3.2 Block Diagram 9 3.3.3 Icon 9 4. System Analysis 10 4.1 Flow Chart – Client 10 4.2 Flow Chart – Server 11 4.3 Floor Plan 12 5. Protocol Design 13 5.1 The Internet and Client-Server Model 13 14 5.2 Using TCP/IP with LabVIEW 15 5.3 Control Interface - Client Connection 16 5.3.1 TCP Open Connection 16 5.3.2 TCP Write 16 5.4 Indicator Interface - Server Connection 17 5.4.1 TCP Listen VI 17 5.4.2 TCP Read 17 6.4.3 TCP Close Connection 18 5.4.4 Clear Error VI 18 6. Hardware Research 19 7. Extra Features 22 7.1 Alarm 22 7.2 Smart Control 23 7.3 Multiple User Login 23 7.4 Master Control 24 8. Assumption 25 9. Limitation 26 10. Future Enhancement 27 11. Conclusion 28 12. References 29 13. Appendix 31 13.1 User Manual 31 13.2 Class Work Program 37 13.2.1 Television 37 1. Acknowledgement First and foremost, I would like to express my deepest gratitude to everyone that made it possible for me to complete this System Programming and Computer Control (SPCC) assignment. This assignment was one of the most challenging task for me but putting in massive amount of determination, awareness and perseverance eventually helped me to excel and complete...

Words: 5590 - Pages: 23

Premium Essay

It Notes for Business

...ADVANCED COMPUTER APPLICATIONS MODULE DEFINE A COMPUTER * An electronic machine that works under the control of stored programs to accept, process & output data/information for use by the operator. * A device that accepts data, processes the data in accordance with a stored program, generates results, and usually consists of input, output, storage, and arithmetic, logic, and control units. * A functional unit that can perform substantial computation, including numerous arithmetic operations or logic operations, without human intervention during a run. * It is an electronic device/machine that accepts data (raw facts & figures) as input and processes (works on it) to produce information (data converted to meaningful form) as output. The computer is made up of hardware, software and peripheral devices. Hardware- refers to the tangible, physical and mechanical components of a computer. Software- refers to the intangible computer components, which are the programs or instructions of the computer. Everything that a computer does, it acts under instructions written out as computer programs. The hardware needs these instructions to function Computer program: * A set of instructions, written in a specific programming language, which a computer follows in processing data, performing an operation, or solving a logical problem. See also software. * A computer program is a set of statements or instructions to be used directly or indirectly in a computer...

Words: 59334 - Pages: 238

Free Essay

Mr Hufdfdsgx

...Disaster Prevention and Management: An International Journal Emergency response preparedness: small group training. Part 2 – training methods compared with learning styles Henry C. Wilson Article information: To cite this document: Henry C. Wilson, (2000),"Emergency response preparedness: small group training. Part 2 – training methods compared with learning styles", Disaster Prevention and Management: An International Journal, Vol. 9 Iss 3 pp. 180 - 199 Permanent link to this document: http://dx.doi.org/10.1108/09653560010335112 Downloaded on: 09 December 2015, At: 11:19 (PT) References: this document contains references to 15 other documents. To copy this document: permissions@emeraldinsight.com The fulltext of this document has been downloaded 1307 times since 2006* Downloaded by Arab Open University Kuwait At 11:19 09 December 2015 (PT) Users who downloaded this article also downloaded: Henry C. Wilson, (2000),"Emergency response preparedness: small group training. Part I – training and learning styles", Disaster Prevention and Management: An International Journal, Vol. 9 Iss 2 pp. 105-116 Piyali Ghosh, Rachita Satyawadi, Jagdamba Prasad Joshi, Rashmi Ranjan, Priya Singh, (2012),"Towards more effective training programmes: a study of trainer attributes", Industrial and Commercial Training, Vol. 44 Iss 4 pp. 194-202 http:// dx.doi.org/10.1108/00197851211231469 Charles W. Read, Brian H. Kleiner, (1996),"Which training methods are effective?", Management...

Words: 13539 - Pages: 55

Free Essay

Linux

...Red Hat Enterprise Linux 5.3 Release Manifest Package Manifest for all Architectures. Red Hat Enterprise Linux Documentation Don Domingo Copyright © 2008 . This material may only be distributed subject to the terms and conditions set forth in the Open Publication License, V1.0 or later (the latest version of the OPL is presently available at http://www.opencontent.org/openpub/). Red Hat and the Red Hat "Shadow Man" logo are registered trademarks of Red Hat, Inc. in the United States and other countries. All other trademarks referenced herein are the property of their respective owners. 1801 Varsity Drive Raleigh, NC 27606-2072 USA Phone: +1 919 754 3700 Phone: 888 733 4281 Fax: +1 919 754 3701 PO Box 13588 Research Triangle Park, NC 27709 USA Abstract This document is a record of all package changes since the last minor update of Red Hat Enterprise Linux 5 1. Added Packages ................................................................................................................... 1 2. Dropped Packages .............................................................................................................. 19 3. Updated Packages ............................................................................................................... 20 1. Added Packages cmirror-1.1.36-1.el5 • Group: System Environment/Base • Summary: cmirror - The Cluster Mirror Package • Description: cmirror - Cluster Mirroring 1 Release Manifest cmirror-kmod-0.1.21-10.el5 • Group: System...

Words: 32183 - Pages: 129

Premium Essay

Internet Ages

...hardware for communication and exchanging information. Just as your brain tells your body parts how to function and work together, the software governs the way computers in the network communicate with each other and perform functions. Software that enables networking follows a set of rules that are generally referred to as protocol. Networks can be interoperable. This means that different types of computers, using different operating systems, can be connected, communicate with each other, and share information - as long as they follow the network protocols. [pic] In Summary: A network is a group of two or more computers, connected together through a physical infrastructure, that are able to communicate and exchange information because they agree to use software that observes the same set of rules, or protocol. WHAT IS THE INTERNET? • A network of networks • Based on TCP/IP (Transmission Control Protocol/Internet Protocol) • Global • A variety of services and tools A network of networks, or "internet," is a group of two or more networks that are: • Interconnected physically • Capable of communicating and sharing data with each other • Able to act together as a single network Machines on one network can communicate with machines on other networks, and send data, files, and other information back and forth. For this to work,...

Words: 48401 - Pages: 194

Premium Essay

Term Paper Topic

...at overall development of human resources. HRD is more concerned with the training and development of employees. Human Resource Development (HRD) means to develop available manpower through suitable methods such as training, promotions, transfers and opportunities for career development. A) Describe the major functions in Human Resource Development (HRD) Frame work of an organization. – 2011 * OR - Features of Human Resource Development, The nature / scope / function / characteristics or features of HRD are as follows :- 1. Training and Development: HRD involves training and developing the employees and managers. It improves their qualities, qualifications and skills. It makes them more efficient in their present jobs. It also prepares them for future higher jobs. 2. Organizational Development (OD): HRD also involves Organizational Development. OD tries to maintain good relations throughout the organization. It also solves problems of absenteeism, internal conflicts, low productivity and resistance to change. 3. Career Development: HRD also involves career planning and development of employees. It helps the employees to plan and develop their careers. It informs them about future promotions and how to get these promotions. So HRD helps the employee to grow and develop in the organization. 4. Performance Appraisal: HRD conducts Performance Appraisal, Potential Appraisal, etc. It informs the employees about their strengths...

Words: 8756 - Pages: 36

Premium Essay

Human Resource Accounting

...poor picture of the profits and profitability of the organization. Likert Objectives of the Study: This unit aims to provide a basis for the conceptual framework of Human Resource Accounting. An attempt is made to highlight the following aspects. Development of the Concept of HRA An Historical Score Card Meaning and Definition of HRA Importance Objectives of Human Resource Accounting Limitations of Human Resource Accounting HRA for managers & HR Professionals Investment in Human Resources Quality of Work Force and Organizations’ Performance Efficient use of Human Resource Enumerating the Assets Calculating the Market Value of Assets Human Capital. 1 MBA –H4020 Human Resource Accounting INTRODUCTION To ensure growth and development of any orgnisation, the efficiency of people must be augmented in the right perspective. Without human resources, the other resources cannot be operationally effective. The original health of the organization is indicated by the human behaviour variables, like group loyalty, skill, motivation and capacity for effective interaction, communication and decision making. Men, materials, machines, money and methods are the resources required for an organization. These resources are broadly classified into two categories, viz., animate and inanimate (human and physical) resources. Men, otherwise known as the human resources, are considered to be animate resources. Others, namely, materials, machines, money and methods are considered to be inanimate...

Words: 55189 - Pages: 221

Premium Essay

Doing Things

...Systems Laboratory (TSLab) School of Information and Communication Technology (ICT) Royal Institute of Technology Stockholm, Sweden 2 Abstract Network virtualization is becoming increasingly significant as other forms of virtualization constantly evolve. The cost of deploying experimental network topologies, the strict enterprise traffic isolation requirements as well as the increasing processing power requirements for virtualized servers make virtualization a key factor in both the research sector as well as the industry, the enterprise network and the datacenter. The definition of network virtualization as well as its manifestations vary widely and depend on the requirements of the environment in which it is deployed. This works sets the foundation towards a network virtualization framework based on a flow-based controlled network protocol like Openflow. 3 Abstract Så småningom, har nätverk virtualization blivit signifikant. Hög kostnaden för att utveckla experimentella nätverk topologier, noggranna kraven för en effektiv trafik isolering samt ökande centralenhets krav för virtuella servrar har gjort nätverk virtualization en viktik faktor i båda forskning och företag. Definitionen av nätverk virtualization samt dess manifestationer beror på miljön som den utvecklas. Den här arbeten försöker att ställa grundvalarna för ett nätverk virtualization framework baserat på ett flow-baserat protokoll som Openflow. Vi beskriver...

Words: 21351 - Pages: 86

Premium Essay

Human Resourse Accounting

...profits and profitability of the organization. Likert Objectives of the Study: This unit aims to provide a basis for the conceptual framework of Human Resource Accounting. An attempt is made to highlight the following aspects.  Development of the Concept of HRA  An Historical Score Card  Meaning and Definition of HRA  Importance  Objectives of Human Resource Accounting  Limitations of Human Resource Accounting  HRA for managers & HR Professionals  Investment in Human Resources  Quality of Work Force and Organizations‟ Performance  Efficient use of Human Resource  Enumerating the Assets  Calculating the Market Value of Assets  Human Capital. INTRODUCTION To ensure growth and development of any orgnisation, the efficiency of people must be augmented in the right perspective. Without human resources, 1 the other resources cannot be operationally effective. The original health of the organization is indicated by the human behaviour variables, like group loyalty, skill, motivation and capacity for effective interaction, communication and decision making. Men, materials, machines, money and methods are the resources required for an organization. These resources are broadly classified into two categories, viz., animate and inanimate (human and physical) resources. Men, otherwise known as the human resources, are considered to be animate resources. Others, namely, materials, machines, money and methods are considered to be inanimate or...

Words: 54154 - Pages: 217