diff --git a/src/Examples/CMakeLists.txt b/src/Examples/CMakeLists.txt index 8fcc4a5de7f5ae768fb9709bddd6d875fd53c257..30502058716dcbff0831e10012fd19c87597e449 100644 --- a/src/Examples/CMakeLists.txt +++ b/src/Examples/CMakeLists.txt @@ -17,3 +17,7 @@ add_subdirectory( flow-vl ) #add_subdirectory( hamilton-jacobi-parallel-map ) #add_subdirectory( fast-sweeping-map ) #add_subdirectory( narrow-band ) + + +ADD_EXECUTABLE( StringExample StringExample.cpp ) +target_link_libraries( StringExample tnl ) \ No newline at end of file diff --git a/src/Examples/StringExample.cpp b/src/Examples/StringExample.cpp index f33da1392cf475cb1b03142057e993e949e9db6c..d6c45dee82f8df3e9fc0074719fce0961b9f8a55 100644 --- a/src/Examples/StringExample.cpp +++ b/src/Examples/StringExample.cpp @@ -1,8 +1,10 @@ #include <iostream> +#include <TNL/String.h> -using namespace TNL +using namespace TNL; +using namespace std; -int main() +int main( int argc, char* argv[] ) { // constructors String str1; @@ -16,23 +18,24 @@ int main() cout << "str4:" << str4 << endl; // functions - int size = str3.getSize(); + /*int size = str3.getSize(); cout << "size of string:" << size << "bytes" << endl; int alloc_size = str3.getAllocatedSize(); cout << "alloc_size:" << alloc_size << endl; - int memory = str1.setSize( 256 ); - cout << "memory:" << memory << endl; + str1.setSize( 256 ); + size = str3.getSize(); + cout << "size of string:" << size << "bytes" << endl;*/ String str setter = str.setString( "Something new" ); cout << "setter:" << setter << endl; - int getter = str4.getString(); + const char* getter = str4.getString(); cout << "getter:" << getter << endl; - String word( computer ) ; + String word( "computer" ) ; third_letter = word[2]; cout << "third_letter:" << third_letter << endl;