ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

acutPrintf displays funny chars in AutoCAD text window

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
533 Views, 3 Replies

acutPrintf displays funny chars in AutoCAD text window

System::String* str = rb->resval.rstring;
acutPrintf("File %s does not exist", str); => this line displays correctly
the name if I'm using debug version of the arx file, but with release
version I get : ô´y ...

Do you know why ?

Thanks for any advice.

I'm using Visual C++ with Managed Extensions:
try

{

struct resbuf *rb;

rb = acedGetArgs();

if (rb == NULL)

acutPrintf("CimsErase function needs arguments to be suplied");

else

{

if (rb->restype == RTSTR)

{

System::String* str = rb->resval.rstring;

str->Replace("\\", "\\\\");

if (System::IO::File::Exists(str))

{

System::IO::File::Delete(str);

}

else

// HERE IS THE PROBLEM

acutPrintf("File %s does not exist", str);

}

else

acutPrintf("First argument of CimsErase must be string");

}

}

catch(System::Exception* ex)

{

acutPrintf("\n CimsErase could not be completed. Exception: %s",
ex->Message);

}
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

> System::String* str = rb->resval.rstring;
> acutPrintf("File %s does not exist", str);

try
acutPrintf("File %s does not exist", (LPCSTR)str);
System::String is probably not automatically cast to (LPCSTR)
Message 3 of 4
Anonymous
in reply to: Anonymous

I get an error C2404 : 'type cast' : cannot convert from 'System::String
__gc *' to 'LPCSTR'. I tried with all LPSTR/LPCWSTR/...

I still cannot explain why the displaying is corect with debug version, but
not with release version.

Thanks anyway.

"Jos Groot Lipman" wrote in message
news:5D5E1771D1559CBF80FFEB441A951D08@in.WebX.maYIadrTaRb...
> > System::String* str = rb->resval.rstring;
> > acutPrintf("File %s does not exist", str);
>
> try
> acutPrintf("File %s does not exist", (LPCSTR)str);
> System::String is probably not automatically cast to (LPCSTR)
>
>
Message 4 of 4
Anonymous
in reply to: Anonymous

You can't cast directly, see "How do I convert
System::String __gc* to native wchar_t* or char*?" at


 

   Dan

 

> I get an error
C2404 : 'type cast' : cannot convert from 'System::String
> __gc *' to
'LPCSTR'. I tried with all LPSTR/LPCWSTR/...
>
> I still cannot
explain why the displaying is corect with debug version, but
> not with
release version.
>
> Thanks anyway.
>
> "Jos Groot
Lipman" <

size=2>dontspam@home.nl
> wrote in
message
>

href="news:5D5E1771D1559CBF80FFEB441A951D08@in.WebX.maYIadrTaRb">
face=Arial
size=2>news:5D5E1771D...

face=Arial size=2>...
> > > System::String* str =
rb->resval.rstring;
> > > acutPrintf("File %s does not exist",
str);
> >
> > try
> >    
acutPrintf("File %s does not exist", (LPCSTR)str);
> > System::String
is probably not automatically cast to (LPCSTR)
> >
> >
>

>

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost