+ Reply to Thread
Results 1 to 2 of 2

Thread: How to do I/O operations

  1. #1

    How to do I/O operations

    What is I/O and when can i use it ?
    Last edited by csharpmaster; 11-12-2012 at 03:03 AM.

  2. #2
    Junior Member
    Join Date
    Jan 2012
    Posts
    36
    I/O stands for Input/Output , i am going to illustrate how to do I/O operations in C# ,
    I/O operations are like :
    1) Create
    2) Delete
    3) Copy
    And more , but i`ll talk about the basic Operations .
    To do I/O operations we need to import this library :
    Code:
    Using System.IO;
    Create File :
    Code:
                 string filename = @"filename11.txt";
                File.Create(filename);
    Create Directory :
    Code:
               string directoryname = @"filename11";
                Directory.CreateDirectory(directoryname);
    
                // OR //
    
                /*!----this is more efficient as it is one line code instead of two----!*/
                Directory.CreateDirectory(@"filename11");
    Delete File & Directory :
    Code:
                string directoryname = @"filename11";
                string filename = @"filename11.txt";
    
                File.Delete(filename);
                Directory.Delete(directoryname);
    Copy a file :
    Code:
             // File.Copy(Source,Destination);
                File.Copy(@"filename.txt", @"C:/filename.txt/");
    Finally , i`ll also illustrate the same basic I/O operations on java inside java section .

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts