Finding characters in a string

If I have a string, how can I grab the first 2 characters and store them in separate strings (or just char variable?)

string random = "random.txt!";

string random grabs file names so it will always change how can I grab the first 2 characters? individually

char1 = 'r' char2 = 'a'

but automatically?

char1 = random[0];
char2 = random[1];
Thanks for the reply god im dumb! I had a string holding all the file names in a vector and forgot to access the filename element first and then the char element

char1 = random[0][0];
char2 = random[0][1];

Few weeks not practicing and my mind has gone to mush! :P
Topic archived. No new replies allowed.