P
philip
If I execute that :
Dim Temp as string = "This is a text"
Dim sw As StreamWriter
Dim fullFileName as string = "c:\text.txt"
sw = New StreamWriter(fullFilename)
sw.Write(temp)
sw.Close()
the resulting file 'Text.txt' has the same length than the string 'temp'.
Same result with I Use BinayWriter.
BUT if 'temp' contains others characters than readable character, then the
result file has not the same length than the string.
So, if temp contains "ÿØÿá" (that is to say a string concanated with the 4
characters chr(255) & chr(216) & chr(255) and chr(225)), the file writen is
8 octets long, and not 4 octets like the string (twice more in the file than
in the string). Same problem with BinaryWriter.
My problem is that I try to write, in a new 'jpg' file, some data loaded in
a memo file. This memo contains the exact image of a 'jpg' file which I must
reproduce.
So with the method exposed above, result cannot good, because this method
does'nt write exactly the octets.
In Access VBA, with the method "open for binary", all is good. I can
reconstruc the 'jpg' file from the memo, then I can see image in a
picturebox.
So I think that I don't use the good method in Visual Studio 2005 to copy
this string on a file without any change.
Can someone help me and tell me the methos to do that ?
Thanks for response.
Dim Temp as string = "This is a text"
Dim sw As StreamWriter
Dim fullFileName as string = "c:\text.txt"
sw = New StreamWriter(fullFilename)
sw.Write(temp)
sw.Close()
the resulting file 'Text.txt' has the same length than the string 'temp'.
Same result with I Use BinayWriter.
BUT if 'temp' contains others characters than readable character, then the
result file has not the same length than the string.
So, if temp contains "ÿØÿá" (that is to say a string concanated with the 4
characters chr(255) & chr(216) & chr(255) and chr(225)), the file writen is
8 octets long, and not 4 octets like the string (twice more in the file than
in the string). Same problem with BinaryWriter.
My problem is that I try to write, in a new 'jpg' file, some data loaded in
a memo file. This memo contains the exact image of a 'jpg' file which I must
reproduce.
So with the method exposed above, result cannot good, because this method
does'nt write exactly the octets.
In Access VBA, with the method "open for binary", all is good. I can
reconstruc the 'jpg' file from the memo, then I can see image in a
picturebox.
So I think that I don't use the good method in Visual Studio 2005 to copy
this string on a file without any change.
Can someone help me and tell me the methos to do that ?
Thanks for response.