list all characters available


Hi
I'm trying to write an app and don't know how to start.
I'll have a selector with a list of true type fonts.
Each font will represent a different set of chars. Example
*arial-font
*arabic-font
*russian-font
*cyrillic-font

When the user select one of them, I should list all chars available in
the font.

With ansi characterset it's easy, just loop from 0-255 and print the
char representation of an integer value, but I don't know how to
achieve this.

Any idea
Posted On: Sunday 4th of November 2012 05:12:24 AM Total Views:  277
View Complete with Replies

RELATED TOPICS OF C Language PROGRAMMING LANGUAGE




Finding more than one person with the same name in a list...Need advice.

! I'm writing a program that deals with structures and works with a list of students. So, I have a function that looks for a student by his name. At first I wrote in a such way that if all three names of a student are entered and they match someone from the list, then the information about the student would be shown. But my teacher wants it in a slightly different way - it should ask for just one name and then it should show all students, even one of whose names match the name entered. For example if you have "Ian Parker Smith" and "Parker Andrew Johnson" (and you enter "Parker") or "Michael Gregory Stuart" and "Michael Francis Edward" (and you enter "Michael"), both of them should be printed on the screen. Instead it prints just one of them, for example if you enter "Michael", just one person, one of whose names are "Michael" will appear and that's the problem. Here are the functions that do it: Code: void Search1N(ListNode* Root) { ListNode* Help1 = Root; char Name[21]; printf("Enter name: "); scanf("%s",Name); while(Help1 != NULL) { if(strcmp(Help1->Pointer->Fname,Name) == 0 || strcmp(Help1->Pointer->Sname,Name) == 0 || strcmp(Help1->Pointer->Lname,Name) == 0) { View(Help1); return; } Help1 = Help1->NextNode; } system("cls"); printf("\n There isn't such person in the list \n"); } void View(ListNode* Help1) { system("cls"); printf("First, Second, Last name: %s %s %s\n",Help1->Pointer->Fname, Help1->Pointer->Sname,Help1->Pointer->Lname); printf("Faculty %s\n Faculty Number: %s\n",Help1->Pointer->FakName,Help1->Pointer->FakNumber); printf("ID: %s\n",Help1->Pointer->ID); printf("Course: %d\n",Help1->Pointer->Course); } I can't figure out what am I doing wrong. Could you give me any advice about this
VIEWS ON THIS POST

275

Posted on:

Tuesday 23rd October 2012
View Replies!

Strooustrup Exercise - doubly-linked list

Problem Statement is in the comments. I am getting compile time error: /* Stroustrup, Chapter 7, exercise 7 * * Consider: * struct Tnode { * string word; * int count; * Tnode* left; * Tnode* right; * }; * * * (1) Write a function for entering new words into a tree of Tnodes. * (2) Write a function to write out a tree of Tnodes. * (3) Write a function to write out a tree of Tnodes in alphabetical order. * (4) Modify Tnode so that it stores (only) a pointer to an arbitrary long * word stored as an array of characters on free store using new. * (5) Modify the functions to use the new definition of Tnode. * * Right now, I am at (1), will do it and only then will go on (2). * * * VERSION 1.0 * */ #include #include struct Tnode { std::string word; int count; Tnode* left; Tnode* right; }; void add_some_words(Tnode* ); int main() { Tnode* my_tree; my_tree->word = NULL; my_tree->count = 0; my_tree->left = NULL; my_tree->right = NULL; add_some_words( my_tree ); return 0; } void add_some_words( Tnode* add_to_tree ) { std::cout word is a std::string and we use operator= for std::string all the time. -- www.lispmachine.wordpress.com my email is @ the above blog.
VIEWS ON THIS POST

226

Posted on:

Saturday 3rd November 2012
View Replies!

Initializer lists

Hi folks, if I have the following class foo{ public: foo(){}; foo(...){}; private: /*data members*/ } class bar{ public: bar(){}; bar(...){}; private: foo _f; } My understanding is that the line foo _f; is equivellent to foo _f(); ie. f is initialised using the default ctor. If my understanding is correct, should an initialiser list be used to initialise _f as follows bar():_f(); or is this duplicating foo _f;
VIEWS ON THIS POST

88

Posted on:

Saturday 3rd November 2012
View Replies!

using a union in an initialization list

I just realized that I cant use a union in an initialization list (or at least not the way I tried to use it). This is what I did: class ValueObject { public: ValueObject(); ValueObject(const ValueObject&); ValueObject& operatr= (const ValueObject&); private: union Item { int i, double d, char s[8]} m_item ; enum { integer, Double, String } m_type ; }; //impl: ValueObject():m_type(Integer), m_item.i(0) //
VIEWS ON THIS POST

138

Posted on:

Saturday 3rd November 2012
View Replies!

boost mpl list

Hi I am new to Boost MPL. What I want to do is to write a metafunction class say OdList. This class accepts any MPL List and return another list comprising of odd numbered elements of the list. Can anyone help me out in this regard
VIEWS ON THIS POST

121

Posted on:

Saturday 3rd November 2012
View Replies!

Post-Sophia mailing, updated core + library issues lists available

The 2008-06 post Sophia mailing, the core WG issues list revision 56 and the library WG issues list revision 57 are now available from the WG21 site at http://www.open-std.org/jtc1/sc22/wg21/ Best regards Keld Simonsen
VIEWS ON THIS POST

175

Posted on:

Saturday 3rd November 2012
View Replies!

How to pass this string into a linked list ?

I am expecting a string of this format: "id1aram1,param2;id2aram1,param2,param3;id" The tokens are seperated by semicolon ";" However each token is really a struct of the following format: struct mst_ { int id; struct params_* parms ; //0 or more struct mst_ *next ; }; where: struct params_ { double argval; struct params_ * next; }; Could anyone suggest an elegant way to parse strings with the specified formatting into a linked list (struct mst_)
VIEWS ON THIS POST

388

Posted on:

Saturday 3rd November 2012
View Replies!

Comparing two lists from "find" and excluding matches

I want to recursively search for subdirectories containing filename1 only, but not filename1 & filename2. I tried using the following csh command but it doesn't work: find ./ -name d3hsp | sed 's/filename1//' | grep -v `find ./ -name d3kil | sed 's/filename2//'` Any suggestions
VIEWS ON THIS POST

146

Posted on:

Saturday 3rd November 2012
View Replies!

Type lists

Has anyone tried doing type lists using something like this pattern struct Some_type_list { typedef List_type A; typedef List_type B; typedef List_type C; typedef C end; }; where: template struct List_type { typedef T Type; typedef Previous_t Previous_type; }; class No_previous_type { }; Example usage: sending packed inter-processor messages. // Val is offset of data for type in message. template struct Offset { static const size_t Val = sizeof(typename Type_in_list::Previous_type) + Offset::Val; }; template struct Offset { static const size_t Val = 0; }; // Val is length of message data (total of sizes of // all types in type list). template struct Data_length { static const size_t Val = sizeof(typename Type_in_list::end) + Offset::Val; }; // Function to set value for type in message. template void set_field( char *data, const typename Type_in_list::Type &val) { memcpy( data + Offset::Val, &val, sizeof(typename Type_in_list::Type)); } // Function to swap byte order using templated // swap_bo function. template void swap_field_bo(char *data) { swap_bo( data + Offset::Val); }
VIEWS ON THIS POST

87

Posted on:

Saturday 3rd November 2012
View Replies!

std::list iterators and swapping

Assume we have this: std::list list1(10, 1), list2(20, 2); std::list::iterator iter = list1.end(); list1.swap(list2); What happens here, according to the standard 1) 'iter' still points to list1::end(). 2) 'iter' now points to list2::end(). 3) Undefined behavior.
VIEWS ON THIS POST

175

Posted on:

Saturday 3rd November 2012
View Replies!

std::list pass by reference initialization error

all, I'm trying to pass a list into a function to edit it but when I compile using g++ I continue to get the following error: maintainNeighbors.cpp:104: error: invalid initialization of non-const reference of type 'std::list&' from a temporary of type 'std::list*' helpers.cpp:99: error: in passing argument 1 of `void CheckIfNeighborsHaveSent(std::list&)' The function is shown below: void CheckIfNeighborsHaveSent(std::list &Neighbors) { std::list::iterator it; std::list::iterator LastIt; struct timeb TimeBuffer; ftime( &TimeBuffer ); it=Neighbors.begin(); while (it!=Neighbors.end()) { int Del=0; if (TimeBuffer.time - it->LastRec > 40) Del=1; LastIt = it; ++it; if (Del==1) Neighbors.erase(LastIt); } } And the objects contained in the list are shown below, along with how it is defined and the function call itself: struct HostID { char IP[16]; int Port; int LastRec; int LastSent; }; std::list ActiveNeighbors; CheckIfNeighborsHaveSent(&ActiveNeighbors); My guess is that it has something to do with the iterator, but I've been stuck on this for a while now and I figure a more experienced person could guide me in the right direction.
VIEWS ON THIS POST

218

Posted on:

Saturday 3rd November 2012
View Replies!

Deleting items from an std::list , is this code correct?

#include #include typedef std::list int_list_t; typedef std::list int_list_iterator_list_t; void print_list(int_list_t &L) { for (int_list_t::iterator it=L.begin();it!=L.end();++it) { std::cout
VIEWS ON THIS POST

140

Posted on:

Saturday 3rd November 2012
View Replies!

for_each iteration in a std::list adds a new element and nextiteration crashes

Hi all, I have this code: class A { std::list m_observadores; void function() { ApplySendMessage apply(this, message); std::for_each(m_observadores.begin(), m_observadores.end(), apply); } } and, ApplySendMessage:perator() adds a new item to the list m_observadores under some conditions. I get (MSVC8.0) "list iterator not incrementable" in an iteration of for_each algorithm after adding (m_observadores.push_back) a new item to the list in the previous iteration (ApplySendMessage = AplicarEnviarMensaje): msvcp80d.dll!std::_Debug_message(const wchar_t * message=0x005fbf30, const wchar_t * file=0x005fbb50, unsigned int line=236) Lnea 24 C++ > libcliente.dll!std::list::_Const_iterator:perator++() Lnea 236 + 0x17 bytes C++ libcliente.dll!std::list::_Iterator:perator++() Lnea 399 C++ libcliente.dll! std::for_each(std::list::_Iterator _First=0x0249b93c, std::list::_Iterator _Last=0xcdcdcdcd, maevif::cliente::AplicarEnviarMensaje _Func={...}) Lnea 28 + 0x8 bytes C++ Is the iterator invalidated after the insertion or my error comes from another place Is this standard m_observadores.push_front instead of m_observadores.push_back will fix that Thank you.
VIEWS ON THIS POST

202

Posted on:

Saturday 3rd November 2012
View Replies!

How to do this in most simple way? about list of arrays

I want to create a list, each element is an array of 2 integers, and I want to sort the list according to the first integer of each element, is there a simple way to do this
VIEWS ON THIS POST

198

Posted on:

Saturday 3rd November 2012
View Replies!

2007-12 mailing + core + library issuse lists available

The C++ 2007-12 mailing, plus the core issues list rev 52 and the library issues list rev 53 is now available from the committee web site at http://www.open-std.org/jtc1/sc22/wg21/ Best regards keld --- [ comp.std.c++ is moderated. To submit articles, try just posting with ] [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ] [ --- Please see the FAQ before posting. --- ] [ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
VIEWS ON THIS POST

228

Posted on:

Saturday 3rd November 2012
View Replies!

initialization of array as a member using the initialization list

, Is this valid template struct ClassA { typedef A value_type; value_type* data_; explicit ClassA(size_t n) : data(new value_type[]()) {} // note the () after [] // other stuff }; Here A is any type, including primitive types. I run valgrind on this code and it gives me the "Conditional jump or move depends on uninitialised value(s)" error. So if it is not valid, why is it Is there a way to default initialize the array in the initialization list Thank you all, aa , On Nov 2, 3:13am, Salt_Peter wrote: > On Nov 1, 6:57pm, aaragon wrote: > > template > > struct ClassA { > > > typedef A value_type; > > value_type* data_; > // if its a pointer, label it as such > value_type* p_data; That's very bad advice. It's already labeled as a pointer; that's what the * means. If being a pointer is an essential part of its semantics, which you do want to reflect in the name, then something like dataPointer can be used, but in my experience, this isn't needed that much. (The one thing that is sometimes useful is a scope indicator; something like myData or m_data to indicate that it is a member variable. In theory, if your names are good, it shouldn't be necessary either, but in practice, it's sometimes an easy way out.) -- James Kanze (GABI Software) email:james.kanze@gmail.com Conseils en informatique oriente objet/ Beratung in objektorientierter Datenverarbeitung 9 place Smard, 78210 St.-Cyr-l'cole, France, +33 (0)1 30 23 00 34
VIEWS ON THIS POST

205

Posted on:

Sunday 4th November 2012
View Replies!

list container

i have a problem when i read c++ primer ,i don't know what the follow codes meaing. char *word[]={"frank","english","edali","slina"}; size_t word_size=sizeof(word)/sizeof(char*); list word2(word,word+word_size); and then what's the contents of list why the word_size=sizeof(word)/ sizeof(char*) i really appreciate your help.
VIEWS ON THIS POST

166

Posted on:

Sunday 4th November 2012
View Replies!

array initialiser list, order of initialisation

In the following code, the initialisation of the array elements depends on the first in the initialiser list being initialised before the second and so on. Can I rely on that #include int main() { int ar[3] = { 1, ar[0]+1, ar[1]+1 }; std::cout
VIEWS ON THIS POST

184

Posted on:

Sunday 4th November 2012
View Replies!

list of objects

all. I have a custom object that i have made. I need to store many of these in a list, and add and delete these objects when i ned them or have finished with them. What is the best solution for holding a dynamic list of objects Are STL containers best Thank you - mataus
VIEWS ON THIS POST

160

Posted on:

Sunday 4th November 2012
View Replies!

N2575: Initializer lists - Alternative mechanism and rationale

I've just read N2575 and welcome its proposals. N2575 takes a step back and provides a simple but brilliant programmer's perspective: the division of concerns into conversions and constructor calls. Here's some feedback. 1. In my view conversion is the important feature of the initializer list proposals. The other feature, an alternative syntax for constructor calls, I find odd and unnecessary. These syntax extensions are confusing parameter lists and initializer lists and add another idiosyncrasy to the language. I would prefer parantheses for constructor calls to always be required and to view curly brackets simply as list construction. 2. I have a gut reaction against std::initializer_list being a built- in type. A stated important goal of the proposals is to erase the special treatment of built-in types. With that in mind the introduction of a new built-in type with special treatment smells bad. The partial built-in status and library implementation is strange. Also, there is already a library type, std::tuple, that better encapsulates an initializer list. Hence it is odd that a lesser type should be preferred. My thoughts on initializer lists: An initializer list is an object of unnamed built-in tuple type. This type is a restricted incomplete type. You can do very little with it until it has manifested itself. The initializer list seeks to manifest itself by converting to another type. Unless an explicit conversion is applied the initializer list looks for a matching constructor or conversion. 1. The best match is a non-explicit unconstrained variadic constructor template. A type such as std::tuple is a perfect match as it fully describes an initializer list; i.e. the number and types of the elements. 2. Second-best match is a non-explicit constrained variadic constructor template. A type such as std::initializer_list is a good match. Concepts constrain the std::initializer_list variadic constructor template to only accept homogenous lists. Here std::initializer_list is an ordinary library type. 3. Implicit constructors and conversion operators are attempted. The initializer list looks for matching number of parameters and type according to N2575/N2531. Implicit conversions of the elements are tried if no perfect matches are found. Aside: Whether narrowing conversions should be allowed is a controversial issue. My inkling is that they should not be allowed, but that their omission should not disambiguate matches (causes surprises). E.g. {1, 1.1} should not match (int, int), but should neither select (int, double) if both are available. It should be ambiguous. How do existing uses of initializer lists fit with this view int a [3] = {1, 2, 3.0}; This is defined to work by converting the initializer list on the right to an array using a built-in variadic constructor template for arrays. This built-in constructor handles implicit conversion. (This allows current narrowing without requiring narrowing to be the general rule.) struct A {int x; int y;} a = {1, 2.0}; This is defined to work by converting the initializer list on the right to an instance of A using a built-in constructor taking parameters (int, double). This means that the constructor call A (1, 2.0) is now allowed without declaring a constructor for A. (Again, these automatically generated constructors takes care of the narrowing issue.) In summary, the overarching ideal for a solution to initializer lists is in my view to erase the special treatment of built-in types. My benchmark: int a [] = {1, 2, 3}; // size deduced std::array = {1, 2, 3}; // should also work Reference: http://www.open-std.org/jtc1/sc22/wg...2008/n2575.pdf
VIEWS ON THIS POST

122

Posted on:

Sunday 4th November 2012
View Replies!