PDA

View Full Version : Error -6 Could not open Output File


Ibrahim
08-09-2007, 07:40 AM
The other error text is "ile does not Exist."

Hello All.

Environment:
Arc2Cad 3.2
X64 but running in a wow32
VB. 2.0

Using a very basic commandline strng:
"D:\Arc2Cad\Test\northamerica_adm0.shp", 0

it chokes on the cold not open output file error.

Ideas from anyone would be nice :)

Ibrahim

GuthCAD Software Support
08-09-2007, 12:00 PM
Hi Ibrahim,

The error code -6 is wrongly documented. It should be 'source file does not exist' rather than 'output file does not exist'. Definitely if the source path is incorrect the -6 error code is produced.

best regards,
Software Support

Ibrahim
18-09-2007, 11:38 AM
Hi :)

Ok, I am getting -6 error saying the file does not exist. But it does exist and it exists at this path:

Using a very basic commandline strng:
chr(34) & "D:\Arc2Cad\Test\northamerica_adm0.shp" & chr(34), 0

Now if I take out the extra quote characters like this:
"D:\Arc2Cad\Test\northamerica_adm0.shp"

I get a different error saying "Command line input file name (D) has incorrect extension.

Notice that the parentheses only show the Drive letter, not the full path.

So what am I doing wrong.

GuthCAD Software Support
18-09-2007, 01:29 PM
Hi Ibrahim,

For C strings, make sure to put a double backslash ('\\') for the backslash character, otherwise it will be interpreted as an escape. I suspect it is the cause of the problem.

best regards,
Software Support

Ibrahim
09-10-2007, 06:17 AM
Hi

>>For C strings, make sure to put a double backslash ('\\') for the backslash >>character, otherwise it will be interpreted as an escape. I suspect it is the >>cause of the problem.

Nope. The dll is reading only the first chartacter of any string I pass it.

If I pass the string "ABCDEFG" I get the I get a different error saying "Command line input file name (A) has incorrect extension.

I am thinking that this may be a unicode problem. what might actually be getting passed to your DLL is chr(65) Chr(0) chr(66) chr(0).

Is your DLL expecting ASCII strings? or Unicode Strings?

Ibrahim

Ibrahim
09-10-2007, 06:27 AM
Unicode does not seem to be the problem either.

I sent a byte array of characters representing a string with a null byte at the end and got the same thing. Only the first character is being recognized.


Do you know of anyone successfully using C# or VB.Net with your DLL?


Ibrahim

GuthCAD Software Support
09-10-2007, 06:31 AM
Hi,

Is your DLL expecting ASCII strings? or Unicode Strings?
It's expecting ASCII strings, so your theory could be right.

You should be able to use a function such as WideCharToMultiByte to get a suitable string to pass.

best regards,
Software Support

GuthCAD Software Support
09-10-2007, 07:06 AM
Hi,

Unicode does not seem to be the problem either.

I sent a byte array of characters representing a string with a null byte at the end and got the same thing. Only the first character is being recognized.

Do you know of anyone successfully using C# or VB.Net with your DLL?

No, I don't. So maybe it just won't work. On the other hand the fact the first character of the string is received seems that there is at least some communication. How about the exec_arcv2cad prototype, is the commandline parameter delcared in your code using *char or *wchar_t ? It should be *char (or the NET equivalent.)

thanks,
Software Support

Ibrahim
10-10-2007, 03:15 AM
Problem solved....

Yes it was a Unicode problem. For possible future Net Users the Declares should be as follows:

Private Declare Ansi Function exec_arcv2cad Lib "D:\Arc2Cad\a2c32.dll" _
(ByVal lpCmdLine As String, ByVal Flags As Int32) As Int32

Private Declare Ansi Function init_arcv2cad Lib "D:\Arc2Cad\a2c32.dll" _
(ByVal lpValue As System.Text.StringBuilder, ByVal Flags As Int32) As Int32

Ibrahim :)

GuthCAD Software Support
10-10-2007, 04:31 AM
Ibrahim,

Ok, well done! :)

Thanks for the Net declare info.

best regards,
Software Support