Smart    Lucky

Smart Lucky

  • NA
  • 555
  • 639.4k

Input OutPut stream

Jul 9 2011 7:25 AM
Hi Dudes

Can any one help me,
I am creating PDF File and it is created successfully but file is not opened in pdf reader  and code is below and if i am reading the content of file it is printing. 


using System;
using System.IO;

class DemoStreaming
{
    static void Main()
    { 
        string path=@"D:\Stream\MyFile.pdf";
        FileStream fs=File.Create (path );
        fs.Close();
        StreamWriter sw = File.CreateText(path);
        sw.WriteLine("Hidaya Trust Pakistan");
        sw.WriteLine("Hidaya Trust USA");
        sw.WriteLine("Hidaya Trust India");
        sw.Close();
        StreamReader reader = File.OpenText(path);
        while (reader.Peek() > 0)
            Console.WriteLine(reader.ReadLine());
        Console.ReadKey();
    }
}

Answers (4)