Tony, you aren't a screenwriter on "Lost". You can give us all the information in one post and it won't count as a spoiler: code and corresponding error message, or crash and corresponding command-line.

Your snippet with _ttoi looks correct, as long as the program has been invoked with at least two parameters. How did you invoke it in that case (i.e. what was the command-line)? Why did it enter the debugger -- is argv[2] NULL? One way to tell is by _tprintf'ing it before you call _ttoi: _tprintf(argv[2] ? argv[2] : _T("NULL")). What does argc equal?

Remember that if argc is 2, only argv[0] and argv[1] are valid strings (but argv[2] is guaranteed to be NULL, only argv[3] and beyond are undefined). If you expect argv[2] to be non-NULL, you should be testing that argc is at least 3.

Peter