Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Functions that return files

Status
Not open for further replies.

dBjason

Programmer
Mar 25, 2005
355
0
0
US
Hello,

I'm trying to write a sub and a function. The function is to return a file to the sub, which will write the file to disk. Something like:

Sub Main()
File.Create("C:\NewPDF_File.pdf", GetPDF)
End Sub

Function GetPDF() as System.IO.FileStream
GetPDF = File.OpenRead("C:\OrigianlPDF.pdf")
End Function

Of course, this does not work. But I'm hoping somebody will get the idea. The 'sub' is in a VB WCF hosted in IIS, the 'function' is a VB WCF hosted in a Windows service. That part really doesn't matter, but thought I should throw it in for the sake of understanding.

So how can I create a function that will return a file, and how can I write that file to disk from the calling procedure?

Any help is greatly appreciated!

Thanks,
Jason
 
why not

Code:
IO.File.Copy("C:\OrigianlPDF.pdf","C:\NewPDF_File.pdf")
?

Zameer Abdulla
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top