4
Reply

Input OutPut stream

Smart    Lucky

Smart Lucky

Jul 9 2011 7:25 AM
2.6k
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)