How to get first 3 characters of an unsigned char (C++)


This Content is from Stack Overflow. Question asked by eurofix

I am trying to build a while loop and this is part of my code

char country1[] = "Switzerland";

    while (1) {
        char *c = get_clipboard_content();

I have successfully got the length of the unsigned char using the code below

(unsigned)strlen(c) == 11

I am now stuck at trying to get the first 3 characters of the unsigned char. What code should I write to get an output like this



This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?