<p>How can I parse integers passed to an application as command line arguments if the app is unicode?</p>

<p>Unicode apps have a main like this:</p>

<pre><code>int _tmain(int argc, _TCHAR* argv[])
</code></pre>

<p>argv[?] is a wchar_t*. That means i can't use atoi. How can I convert it to an integer? Is stringstream the best option?</p>

if you have a TCHAR array or a pointer to the begin of it, you can use
```
std::basic_istringstream
```
to work with it:
```
```
std::basic_istringstream<_TCHAR> ss(argv[x]);
int number;
ss >> number;
```
```
Now,
```
number
```
is the converted number. This will work in ANSI mode (_TCHAR is typedef'ed to
```
char
```
) and in Unicode (_TCHAR is typedef`ed to wchar_t as you say) mode.