473,385 Members | 1,275 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

File To Stream - Stream To File

Hello,

I Write this code for get Stream from a file :

Dim _Stream As Stream = New FileStream("C:\Test.bin", FileMode.Open,
FileAccess.Read)

This code for Put Stream to File :

Dim i As Integer
Dim fs As FileStream = New FileStream("C:\app\test.bin",
FileMode.CreateNew,FileAccess.Write)
Dim str As StreamReader = New StreamReader(_Stream)
Dim stw As StreamWriter = New StreamWriter(fs, System.Text.Encoding.Unicode)
stw.BaseStream.Seek(0, SeekOrigin.End)
stw.Write(Str.ReadToEnd())
fs.Close()
Str.Close()

Not Works ....

Where i'm Wrong
Nov 21 '05 #1
3 12747
Giuseppe,

I tried your code, (with existing folders and file) and it did work fine for
me

Although file.copy(old,new) is in this case of course an easier command.

:-)

I hope this helps,

Cor

"Giuseppe" <pe***@msn.com> schreef in bericht
news:O5**************@TK2MSFTNGP15.phx.gbl...
Hello,

I Write this code for get Stream from a file :

Dim _Stream As Stream = New FileStream("C:\Test.bin", FileMode.Open,
FileAccess.Read)

This code for Put Stream to File :

Dim i As Integer
Dim fs As FileStream = New FileStream("C:\app\test.bin",
FileMode.CreateNew,FileAccess.Write)
Dim str As StreamReader = New StreamReader(_Stream)
Dim stw As StreamWriter = New StreamWriter(fs,
System.Text.Encoding.Unicode)
stw.BaseStream.Seek(0, SeekOrigin.End)
stw.Write(Str.ReadToEnd())
fs.Close()
Str.Close()

Not Works ....

Where i'm Wrong

Nov 21 '05 #2
I must send it to a remote server..

Nov 21 '05 #3
Giuseppe,
I must send it to a remote server..


In your sample you are showing from C:\xxx to C:\xxx

Why are you showing that, just to have fun that we try to help you?

Cor
Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Siddharth Taneja | last post by:
Hi, I have a very simple prg over here, trying to read the lines of a file #include <iostream> #include <fstream> #include <iostream> #include <string> using namespace std;
2
by: gnv | last post by:
Hi all, I am writing a cross-browser(i.e. 6 and netscape 7.1) javascript program to save an XML file to local file system. I have an xml string like below: var xmlStr = "<?xml version="1.0"...
19
by: Johnny Google | last post by:
Here is an example of the type of data from a file I will have: Apple,4322,3435,4653,6543,4652 Banana,6934,5423,6753,6531 Carrot,3454,4534,3434,1111,9120,5453 Cheese,4411,5522,6622,6641 The...
13
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
5
by: Daniel Corbett | last post by:
I am trying to save a file dynamically created in a webpage. I get the following headers, but cannot figure out how to save the attachment. I am basically trying to replicate what internet...
5
by: IcingDeath via DotNetMonster.com | last post by:
I am building this SQL Server database app in which i can store files. In order to display files I want to have the app show the associated icon for the extension of the file that is in the...
4
by: rony_16 | last post by:
Hi, I have a program that connects to a site With WebRequest and WebResponse . The response of this site is a file (csv file). The problem is that the file do not comes as a stream , hi is a part...
5
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C++ programming. FYI Although I have called...
6
by: J055 | last post by:
Hi I have the following code. I upload an XML file using the FileUpload object, store the stream in a session so the user gets the chance to confirm some options then pass the stream from the...
45
by: Dennis | last post by:
Hi, I have a text file that contents a list of email addresses like this: "foo@yahoo.com" "tom@hotmail.com" "jerry@gmail.com" "tommy@apple.com" I like to
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.