tags:

views:

80

answers:

1

Hi, I am trying to write a C++ Console based application which collects and populates each characters typed in the console to a std::vector <char *> asynchronously without blocking the user Can anyone help me in how to populate each char entered in std::vector <char *> .

John

+1  A: 

You dont need to do it asynchronously.

std::vector<char> foo;

void populate(char a)
{
    foo.push_back(a);
}
zitronic
But,I have requirement I should populate the vector in one thread and then should iterate and print the same vector in another thread,how can i don it critical section
vikram
@john: The answers to that vary widely depending on the thread library you're using. I suggest you modify your original question, stating the requirements, and what tools (compiler, libraries, etc.) you're using. Oh, and I already added the `homework` tag to your question, so that people will give you nudges into the right direction instead of pasting code.
sbi