creating a file from input stream

Posted by daemonkid on Stack Overflow See other posts from Stack Overflow or by daemonkid
Published on 2010-05-30T11:54:42Z Indexed on 2010/05/30 12:12 UTC
Read the original article Hit count: 273

Filed under:
|

My component will receive a pdf file as a filestream from which I will need to create a file.

For testing purposes I am trying to read a file using the filestream object and recreate it at a different location. But the recreated file is created blank. the recreated file has the same number of pages though...

This is the code

StreamReader sr = new StreamReader(_filePath);
str = sr.ReadToEnd();
File.WriteAllText(@"C:\recreated.pdf", str);

what am I doing wrong?

© Stack Overflow or respective owner

Related posts about c#

Related posts about filestream