Hi all, as from object i need to read all byte from a file example c:
\myphoto.jpg and recreate the file with another name to another
directory c:\photo\recreatedphoto.jpg can someone write a small
example to do it?
thx a lot men :) 8 2022
You can use these methods to load and save an image.
Dim image1 As Image =
System.Drawing.Image.FromFile("somefilepath.jpg")
image1.Save("someotherfilepath.jpg",
System.Drawing.Imaging.ImageFormat.Jpeg)
==============
Clay Burch
Syncfusion, Inc.
On 1 Feb, 14:04, "ClayB" <c...@syncfusion.comwrote:
You can use these methods to load and save an image.
Dim image1 As Image =
System.Drawing.Image.FromFile("somefilepath.jpg")
image1.Save("someotherfilepath.jpg",
System.Drawing.Imaging.ImageFormat.Jpeg)
==============
Clay Burch
Syncfusion, Inc.
Thx for reply, but this should work only with images, i need to read
all bytes and recreate the file from the readed bytes, to make it
compatible with all type of file
On Feb 1, 8:50 am, "paraidy" <samore...@tiscali.itwrote:
On 1 Feb, 14:04, "ClayB" <c...@syncfusion.comwrote:
You can use these methods to load and save an image.
Dim image1 As Image =
System.Drawing.Image.FromFile("somefilepath.jpg")
image1.Save("someotherfilepath.jpg",
System.Drawing.Imaging.ImageFormat.Jpeg)
==============
Clay Burch
Syncfusion, Inc.
Thx for reply, but this should work only with images, i need to read
all bytes and recreate the file from the readed bytes, to make it
compatible with all type of file
Are you doing this to just move the file? If so just use
System.IO.File.Move(....) - afaik it's compatible with all file types.
Thanks,
Seth Rowe
On Feb 1, 9:01 am, "rowe_newsgroups" <rowe_em...@yahoo.comwrote:
On Feb 1, 8:50 am, "paraidy" <samore...@tiscali.itwrote:
On 1 Feb, 14:04, "ClayB" <c...@syncfusion.comwrote:
You can use these methods to load and save an image.
Dim image1 As Image =
System.Drawing.Image.FromFile("somefilepath.jpg")
image1.Save("someotherfilepath.jpg",
System.Drawing.Imaging.ImageFormat.Jpeg)
==============
Clay Burch
Syncfusion, Inc.
Thx for reply, but this should work only with images, i need to read
all bytes and recreate the file from the readed bytes, to make it
compatible with all type of file
Are you doing this to just move the file? If so just use
System.IO.File.Move(....) - afaik it's compatible with all file types.
Thanks,
Seth Rowe
Guess I could of given an answer to the original question :-)
How about this?
Dim readStream As Stream = File.Open("C:\Documents and
Settings\srowe\Desktop\pic.jpg", FileMode.Open, FileAccess.Read)
Dim writeStream As Stream = File.Open("C:\Documents and
Settings\srowe\Desktop\pic2.jpg", FileMode.Create, FileAccess.Write)
Dim bw As New BinaryWriter(writeStream)
Dim br As New BinaryReader(readStream)
Do Until br.PeekChar = -1
bw.Write(br.ReadByte)
Loop
Thanks,
Seth Rowe
rowe_newsgroups ha scritto:
On Feb 1, 9:01 am, "rowe_newsgroups" <rowe_em...@yahoo.comwrote:
On Feb 1, 8:50 am, "paraidy" <samore...@tiscali.itwrote:
On 1 Feb, 14:04, "ClayB" <c...@syncfusion.comwrote:
You can use these methods to load and save an image.
Dim image1 As Image =
System.Drawing.Image.FromFile("somefilepath.jpg")
image1.Save("someotherfilepath.jpg",
System.Drawing.Imaging.ImageFormat.Jpeg)
==============
Clay Burch
Syncfusion, Inc.
Thx for reply, but this should work only with images, i need to read
all bytes and recreate the file from the readed bytes, to make it
compatible with all type of file
Are you doing this to just move the file? If so just use
System.IO.File.Move(....) - afaik it's compatible with all file types.
Thanks,
Seth Rowe
Guess I could of given an answer to the original question :-)
How about this?
Dim readStream As Stream = File.Open("C:\Documents and
Settings\srowe\Desktop\pic.jpg", FileMode.Open, FileAccess.Read)
Dim writeStream As Stream = File.Open("C:\Documents and
Settings\srowe\Desktop\pic2.jpg", FileMode.Create, FileAccess.Write)
Dim bw As New BinaryWriter(writeStream)
Dim br As New BinaryReader(readStream)
Do Until br.PeekChar = -1
bw.Write(br.ReadByte)
Loop
Thanks,
Seth Rowe
Probably this is what i need, when i comeback to home i test it and
i'll post a reply, Very Thanks :)
On 1 Feb, 16:30, "paraidy" <samore...@tiscali.itwrote:
rowe_newsgroups ha scritto:
On Feb 1, 9:01 am, "rowe_newsgroups" <rowe_em...@yahoo.comwrote:
On Feb 1, 8:50 am, "paraidy" <samore...@tiscali.itwrote:
On 1 Feb, 14:04, "ClayB" <c...@syncfusion.comwrote:
You can use these methods to load and save an image.
Dim image1 As Image =
System.Drawing.Image.FromFile("somefilepath.jpg")
image1.Save("someotherfilepath.jpg",
System.Drawing.Imaging.ImageFormat.Jpeg)
==============
Clay Burch
Syncfusion, Inc.
Thx for reply, but this should work only with images, i need to read
all bytes and recreate the file from the readed bytes, to make it
compatible with all type of file
Are you doing this to just move the file? If so just use
System.IO.File.Move(....) - afaik it's compatible with all file types.
Thanks,
Seth Rowe
Guess I could of given an answer to the original question :-)
How about this?
Dim readStream As Stream = File.Open("C:\Documents and
Settings\srowe\Desktop\pic.jpg", FileMode.Open, FileAccess.Read)
Dim writeStream As Stream = File.Open("C:\Documents and
Settings\srowe\Desktop\pic2.jpg", FileMode.Create, FileAccess.Write)
Dim bw As New BinaryWriter(writeStream)
Dim br As New BinaryReader(readStream)
Do Until br.PeekChar = -1
bw.Write(br.ReadByte)
Loop
Thanks,
Seth Rowe
Probably this is what i need, when i comeback to home i test it and
i'll post a reply, Very Thanks :)
i have tryied it, it worked with a txt file, but with a .exe of 4 MB
there is an error in this line:
Do Until br.PeekChar = -1
the error is this:
The output char buffer is too small to contain the decoded characters,
encoding 'Unicode (UTF-8)' fallback
'System.Text.DecoderReplacementFallback'.
some help? :(
On Feb 1, 12:14 pm, "paraidy" <samore...@tiscali.itwrote:
On 1 Feb, 16:30, "paraidy" <samore...@tiscali.itwrote:
rowe_newsgroups ha scritto:
On Feb 1, 9:01 am, "rowe_newsgroups" <rowe_em...@yahoo.comwrote:
On Feb 1, 8:50 am, "paraidy" <samore...@tiscali.itwrote:
On 1 Feb, 14:04, "ClayB" <c...@syncfusion.comwrote:
You can use these methods to load and save an image.
Dim image1 As Image =
System.Drawing.Image.FromFile("somefilepath.jpg")
image1.Save("someotherfilepath.jpg",
System.Drawing.Imaging.ImageFormat.Jpeg)
==============
Clay Burch
Syncfusion, Inc.
Thx for reply, but this should work only with images, i need to read
all bytes and recreate the file from the readed bytes, to make it
compatible with all type of file
Are you doing this to just move the file? If so just use
System.IO.File.Move(....) - afaik it's compatible with all file types.
Thanks,
Seth Rowe
Guess I could of given an answer to the original question :-)
How about this?
Dim readStream As Stream = File.Open("C:\Documents and
Settings\srowe\Desktop\pic.jpg", FileMode.Open, FileAccess.Read)
Dim writeStream As Stream = File.Open("C:\Documents and
Settings\srowe\Desktop\pic2.jpg", FileMode.Create, FileAccess.Write)
Dim bw As New BinaryWriter(writeStream)
Dim br As New BinaryReader(readStream)
Do Until br.PeekChar = -1
bw.Write(br.ReadByte)
Loop
Thanks,
Seth Rowe
Probably this is what i need, when i comeback to home i test it and
i'll post a reply, Very Thanks :)
i have tryied it, it worked with a txt file, but with a .exe of 4 MB
there is an error in this line:
Do Until br.PeekChar = -1
the error is this:
The output char buffer is too small to contain the decoded characters,
encoding 'Unicode (UTF-8)' fallback
'System.Text.DecoderReplacementFallback'.
some help? :(
I hate doing it like this, but at the moment my brain can't think of a
way to check for the end of the file without using PeekChar (which
overflows) or using a try catch (slightly inefficient) but hey, free
help doesn't have to be perfect right?
Try this code instead:
Dim readStream As Stream = File.Open("C:\Documents and Settings
\srowe\Desktop\CSDB.Net.exe", FileMode.Open, FileAccess.Read)
Dim writeStream As Stream = File.Open("C:\Documents and
Settings\srowe\Desktop\CSDB.Net2.exe", FileMode.Create,
FileAccess.Write)
Dim bw As New BinaryWriter(writeStream,
System.Text.Encoding.UTF8)
Dim br As New BinaryReader(readStream,
System.Text.Encoding.UTF8)
Do
Try
Dim i As Int32 = br.ReadInt32()
bw.Write(i)
Catch ex As EndOfStreamException
Exit Do
End Try
Loop
Let me know how it works out.
Thanks,
Seth Rowe
On 1 Feb, 19:25, "rowe_newsgroups" <rowe_em...@yahoo.comwrote:
On Feb 1, 12:14 pm, "paraidy" <samore...@tiscali.itwrote:
On 1 Feb, 16:30, "paraidy" <samore...@tiscali.itwrote:
rowe_newsgroups ha scritto:
On Feb 1, 9:01 am, "rowe_newsgroups" <rowe_em...@yahoo.comwrote:
On Feb 1, 8:50 am, "paraidy" <samore...@tiscali.itwrote:
On 1 Feb, 14:04, "ClayB" <c...@syncfusion.comwrote:
You can use these methods to load and save an image.
Dim image1 As Image =
System.Drawing.Image.FromFile("somefilepath.jpg")
image1.Save("someotherfilepath.jpg",
System.Drawing.Imaging.ImageFormat.Jpeg)
==============
Clay Burch
Syncfusion, Inc.
Thx for reply, but this should work only with images, i need to read
all bytes and recreate the file from the readed bytes, to make it
compatible with all type of file
Are you doing this to just move the file? If so just use
System.IO.File.Move(....) - afaik it's compatible with all file types.
Thanks,
Seth Rowe
Guess I could of given an answer to the original question :-)
How about this?
Dim readStream As Stream = File.Open("C:\Documents and
Settings\srowe\Desktop\pic.jpg", FileMode.Open, FileAccess.Read)
Dim writeStream As Stream = File.Open("C:\Documents and
Settings\srowe\Desktop\pic2.jpg", FileMode.Create, FileAccess.Write)
Dim bw As New BinaryWriter(writeStream)
Dim br As New BinaryReader(readStream)
Do Until br.PeekChar = -1
bw.Write(br.ReadByte)
Loop
Thanks,
Seth Rowe
Probably this is what i need, when i comeback to home i test it and
i'll post a reply, Very Thanks :)
i have tryied it, it worked with a txt file, but with a .exe of 4 MB
there is an error in this line:
Do Until br.PeekChar = -1
the error is this:
The output char buffer is too small to contain the decoded characters,
encoding 'Unicode (UTF-8)' fallback
'System.Text.DecoderReplacementFallback'.
some help? :(
I hate doing it like this, but at the moment my brain can't think of a
way to check for the end of the file without using PeekChar (which
overflows) or using a try catch (slightly inefficient) but hey, free
help doesn't have to be perfect right?
Try this code instead:
Dim readStream As Stream = File.Open("C:\Documents and Settings
\srowe\Desktop\CSDB.Net.exe", FileMode.Open, FileAccess.Read)
Dim writeStream As Stream = File.Open("C:\Documents and
Settings\srowe\Desktop\CSDB.Net2.exe", FileMode.Create,
FileAccess.Write)
Dim bw As New BinaryWriter(writeStream,
System.Text.Encoding.UTF8)
Dim br As New BinaryReader(readStream,
System.Text.Encoding.UTF8)
Do
Try
Dim i As Int32 = br.ReadInt32()
bw.Write(i)
Catch ex As EndOfStreamException
Exit Do
End Try
Loop
Let me know how it works out.
Thanks,
Seth Rowe
Yes, it worked, Very Thanks!!! This discussion thread is closed Replies have been disabled for this discussion. Similar topics
2 posts
views
Thread by hvaisane |
last post: by
|
18 posts
views
Thread by jas |
last post: by
|
5 posts
views
Thread by Sumana |
last post: by
|
4 posts
views
Thread by ad |
last post: by
|
3 posts
views
Thread by phwashington |
last post: by
|
2 posts
views
Thread by Kevin Ar18 |
last post: by
|
9 posts
views
Thread by vineeth |
last post: by
|
3 posts
views
Thread by =?Utf-8?B?VHJlY2l1cw==?= |
last post: by
| | | | | | | | | | | |