Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Sunday, August 13, 2017 4:31:37 PM(UTC)

TBone  
TBone

Groups: Registered
Posts: 11

Thanks: 1 times

Hi,

I am using L_LoadBitmap based functions for my OCR and noticed that it take L_TCHAR pointers while rest of the UI work in String based. Are there API functions that take String or some easy way of converting String to L_TCHAR? I am sure someone would have encountered this before.
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Thursday, August 17, 2017 3:22:24 PM(UTC)

Joe Z  
Joe Z

Groups: Registered, Tech Support, Administrators
Posts: 34

Was thanked: 1 time(s) in 1 post(s)

Converting from a String to an L_TCHAR requires a few simple steps.

First, you must convert your existing String to a CString object using the c_str() function. This will give you a 'C' compatible string to work with. Note, a 'C' compatible string is a char array.

From here, you would then cast this array into a T_CHAR. Finally you can cast this T_CHAR array into an L_TCHAR to obtain your desired output. I'll include sample code of performing these steps below.

Code:

 string test = "C:\\Users\\Public\\Documents\\LEADTOOLS Images\\cannon.jpg";
 CString out = test.c_str();
 L_TCHAR* newout = (L_TCHAR*)((LPCTSTR)out);
Joe Zhan
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2017, Yet Another Forum.NET
This page was generated in 0.125 seconds.