473,327 Members | 2,071 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,327 software developers and data experts.

Could not find a part of the path "C:\temp\".

Dear sir,

I am trying to save a binary data by below script, however,it always give me
an error of "Could not find a part of the path "C:\temp\". "

Any idea what I did wrong here?

Public Sub SaveAs(ByVal strPath As String)

If strPath.EndsWith("\") = False Then
strPath += "\"
End If

Dim binaryData() As Byte
binaryData = System.Convert.FromBase64String(m_Filestring)

'Write out the decoded data.
Dim outFile As System.IO.FileStream
Dim OutFileName As String = strPath + m_FileName
outFile = New System.IO.FileStream(OutFileName,
System.IO.FileMode.Create, System.IO.FileAccess.Write)
outFile.Write(binaryData, 0, binaryData.Length - 1)
outFile.Close()

End Sub

--
Kind regards

Guoqi Zheng
guoqi AT meetholland dot com
Http://www.meetholland.com

Nov 21 '05 #1
2 5121
On Tue, 17 Aug 2004 01:49:55 +0200, Guoqi Zheng wrote:
Dear sir,

I am trying to save a binary data by below script, however,it always give me
an error of "Could not find a part of the path "C:\temp\". "

Any idea what I did wrong here?

Public Sub SaveAs(ByVal strPath As String)

If strPath.EndsWith("\") = False Then
strPath += "\"
End If

Dim binaryData() As Byte
binaryData = System.Convert.FromBase64String(m_Filestring)

'Write out the decoded data.
Dim outFile As System.IO.FileStream
Dim OutFileName As String = strPath + m_FileName
outFile = New System.IO.FileStream(OutFileName,
System.IO.FileMode.Create, System.IO.FileAccess.Write)
outFile.Write(binaryData, 0, binaryData.Length - 1)
outFile.Close()

End Sub


Imports System
Imports System.IO

Public Sub SaveAs (ByVal strPath As String)
Dim outFile As FileStream

Try
' you don't need the if test for the path - .net
' already has a class that handles this :)
Dim outFileName As String = Path.Combine (strPath, m_FileName)
Dim binaryData() As Byte = _
Convert.FromBase64String (m_FileString)

outFile = New FileStream _
(outFileName, FileMode.Create, FileAccess.Write)
outFile.Write (binaryData, 0, binaryData.Length)

' insert catch here if you wish to process exceptions,
' other wise, just make sure you do the necessary clean up
' in the finally and the exception will go up to the caller
Finally
If Not outFile Is Nothing Then
outFile.Close()
End If
End Try
End Sub

You may have to show the calling code to get a final answer though...
Since, more then likely the path being passed in is invalid.

--
Tom Shelton [MVP]
Nov 21 '05 #2
Thanks for your reply. I have used some of your code.

problem solved, because m_FileName is nothing.

--
Kind regards

Guoqi Zheng
guoqi AT meetholland dot com
Http://www.meetholland.com

"Tom Shelton" <to*@YOUKNOWTHEDRILLmtogden.com> wrote in message
news:12****************************@40tude.net...
On Tue, 17 Aug 2004 01:49:55 +0200, Guoqi Zheng wrote:
Dear sir,

I am trying to save a binary data by below script, however,it always give me an error of "Could not find a part of the path "C:\temp\". "

Any idea what I did wrong here?

Public Sub SaveAs(ByVal strPath As String)

If strPath.EndsWith("\") = False Then
strPath += "\"
End If

Dim binaryData() As Byte
binaryData = System.Convert.FromBase64String(m_Filestring)

'Write out the decoded data.
Dim outFile As System.IO.FileStream
Dim OutFileName As String = strPath + m_FileName
outFile = New System.IO.FileStream(OutFileName,
System.IO.FileMode.Create, System.IO.FileAccess.Write)
outFile.Write(binaryData, 0, binaryData.Length - 1)
outFile.Close()

End Sub


Imports System
Imports System.IO

Public Sub SaveAs (ByVal strPath As String)
Dim outFile As FileStream

Try
' you don't need the if test for the path - .net
' already has a class that handles this :)
Dim outFileName As String = Path.Combine (strPath, m_FileName)
Dim binaryData() As Byte = _
Convert.FromBase64String (m_FileString)

outFile = New FileStream _
(outFileName, FileMode.Create, FileAccess.Write)
outFile.Write (binaryData, 0, binaryData.Length)

' insert catch here if you wish to process exceptions,
' other wise, just make sure you do the necessary clean up
' in the finally and the exception will go up to the caller
Finally
If Not outFile Is Nothing Then
outFile.Close()
End If
End Try
End Sub

You may have to show the calling code to get a final answer though...
Since, more then likely the path being passed in is invalid.

--
Tom Shelton [MVP]

Nov 21 '05 #3

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

Similar topics

3
by: Arnaldo Martinez | last post by:
Hi, friends: I have an ASP page where an user enter a value and click the submit button. I want this value to be transfer to a session("temp") within the same page where I want to call it back...
34
by: Pmb | last post by:
I've been working on creating a Complex class for my own learning purpose (learn through doing etc.). I'm once again puzzled about something. I can't figure out how to overload the assignment...
10
by: Dieter Salath? | last post by:
Hi, in our webpage, a user could open a windows explorer to his temp directory with a simple link and usage of the file protocol: <a href="file://C:\temp" target="_blank">C:\temp</a> This...
5
by: Prakash | last post by:
Does anyone know how to compact a table (only) ? I'm using some code o move rows up & down in a continuous form & it works fine, but after some usage the rows refuse to move up or down until I...
13
by: Larry Menard | last post by:
Test code: $dbconn = odbc_connect($dbname, $username, $password); $path = "C:\Temp\myJar.jar"; $statement = "CALL SQLJ.INSTALL_JAR('file://$path', 'myJarId')"; $result = odbc_exec($dbconn,...
13
by: Fao | last post by:
Hello, I am having some problems with inheritance. The compiler does not not return any error messages, but when I execute the program, it only allows me to enter the number, but nothing else...
19
by: Neil Cerutti | last post by:
Where can I find documentation of what Python accepts as the filename argument to the builtin function file? As an example, I'm aware (through osmosis?) that I can use '/' as a directory...
11
by: arnuld | last post by:
i have created a new temperature conversion programme. it converts a temperature from Fahrenheit to Celsius or from Celsius to Fahrenheit at user's will. tell em if i need some improvements: ...
10
by: =?Utf-8?B?TWF0dA==?= | last post by:
I am using the following code to connect to and download files from an ftp server, but the Symantec anti-virus software on some of my customers machines tells them that their computers are...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.