Getting Input in SDL

I'm making a program that after you lose, if you get a high-score, it lets you input your initials. I've tried to write code for that but it's not working at all. The code I have so far for getting input is

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
void High_Score::RecordName()
{
    bool HitEnter = false;
    String_Name = "";
    while (!HitEnter)
    {
        SDL_Event Event;
        while (SDL_PollEvent(&Event))
        {
            if (Event.type == SDL_KEYDOWN)
            {
                if (String_Name.length() < limit)
                {
                    //cout<<String_Name.length()<<endl;
                    if ( Event.key.keysym.unicode >= (Uint16)'a' and Event.key.keysym.unicode <= (Uint16)'z' )
                    {
                        String_Name += (char)Event.key.keysym.unicode;
                        exit(80);
                    }
                    else if ( Event.key.keysym.unicode >= (Uint16)'A' and Event.key.keysym.unicode <= (Uint16)'Z' )
                    {
                        String_Name += (char)Event.key.keysym.unicode;
                        exit(81);
                    }
                }

                if (Event.key.keysym.sym == SDLK_BACKSPACE and String_Name.length() > 0)
                {
                    String_Name.erase(String_Name.length() - 1);
                    exit(82);
                }

                else if (Event.key.keysym.sym == SDLK_RETURN and String_Name.length() != 0)
                {
                    HitEnter = true;
                    SDL_FreeSurface(Surface_Name);
                    Surface_Name = TTF_RenderText_Solid(Font_Name,String_Name.c_str(),Color);
                    exit(83);
                }
            }
        }
        SDL_FillRect(screen,&screen->clip_rect,SDL_MapRGB(screen->format,0,0,0));
        if (String_Name.length() > 0){
        exit(84);
        SDL_FreeSurface(Surface_Name);
        Surface_Name = TTF_RenderText_Solid(Font_Name,String_Name.c_str(),Color);

        apply_surface( screen->w/2 - Surface_Name->w/2, screen->h/2 + Surface_Name->h/2, Surface_Name, screen );

        }
        SDL_Flip(screen);
    }
}


That cout was just so I knew that the code executed up to that point and the exits are to check to see if the code ever reaches any of those points, which it doesn't. Does anyone see any errors that I could've missed?
after adding this piece of code,
cout<<Event.key.keysym.unicode<<endl<<(Uint16)'a'<<endl<<endl;

it seems that every key that I press is returning a 0 in unicode. Does anyone know any possible reason for that?

Have you called SDL_EnableUNICODE(SDL_ENABLE); somewhere in your program?
No, I had not. Thanks, it seems to be working now
Topic archived. No new replies allowed.