Click here to Skip to main content
15,889,992 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a C++ program(the gpc program clipper) and a vb wrapper for it.

I have one problem in it. When i call fopen with a "file.out"
as string.fopen gets a collection of words instead of bytes and feels that I gave only 1 char followed by a null.

How do I manage to send a cstyle string?

in vb.net:
problem using vb.net(dotnet) string(16 bit unicode) to a c function expecting 8 bit byte string
Private Declare Auto Function fopen Lib msvcr100.dll (ByVal fn As String, ByVal mode As String) As IntPtr
Posted
Updated 28-Jul-10 1:51am
v3
Comments
Sandeep Mewara 28-Jul-10 7:51am    
Your last part of question, from 'in vb.net..." - it's unclear. You can use 'Improve Question' to edit and update the last part.

In "old" vb you would use StrConv. In VB.NET you should use the Encoding class. Have look at the link below.

http://msdn.microsoft.com/en-us/library/system.text.encoding.aspx[^]

Good luck!
 
Share this answer
 
I managed it by replacing Auto by Ansi in the Declare statement for fopen.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900