Languages

Menu
Sites
Language
How to use string?

I have 4 question about string.

 

I'm using tizen studio and my native app consist of each one main.c and main.h.

For text, I only used unsigned char.  As far as I know, Tizen support C++ string and Tizen::Base::String.

But I can't declare String, string and Tizen::Base::String.

My main.h have #include <string.h>.

How can I use both c++ string and tizen string(Tizen::Base::String) in my project?

 

And my main.c is c file.

When I change main.c to main.cpp, there are error.

There are any way to chage c to cpp?

 

Tizen::Base::String support c? or only c++?

 

Android and c++ string is class.  Tizen::Base::String is also a class?  There are any site for tizen variable?  In this site, I can see only methods.

Responses

2 Replies
Mango Bar

Currently C is the native language of Tizen because most of the API are written as C function. There is a C++ library called DALi. You will find several sample app in Tizen Studio under Mobile UI segment.

But if you want, you can still use C++ in your code. For that, you have to change some settings in Tizen studio as follows

Step-1: Your source file must be in cpp extension (filename.cpp)

After that you have to change compiler settings for C++

Step-2: Right click on your project then go to

Properties --> C/C++ Build --> Settings --> Tool Settings --> C++ Compiler --> Dialect

Now select C++11 from "Language Standard" menu. After that Click OK to save it.

Step-3: Again Right click on project then go to

Properties --> C/C++ Build --> Tizen Settings --> Platform

Then goto "Toolchain Information" section and select any one from GCC-4.9 (default) or LLVM GCC-4.9 (default) from "Name" dropdown menu. Finally click OK to save it.

Zoltan Puski

Android and c++ string is class.  Tizen::Base::String is also a class? 

  1. Tizen native language is C, not C++ !
  2. C is NOT OOP language. No classes.
  3. C supports low level string functionality, with single byte char strings. strcpy, strlen, etc.
    1. Don't forget to allocate/free memory yourselves for all your strings. Unless use static length char arrays. But then take care of max length.
  4. If you need Unicode, there are i18n libraries, but good luck with it :)