Thread: _TCHAR * argv to char

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    17

    Question _TCHAR * argv to char

    Hello,

    I want to transform the input argument to a char.

    For example, there is a 'A' in my argv[3], in the argument, and I want to use it as a char in my main program.

    BTW, I use unicode and I have to use it.
    I have already tried to use

    char(argv[3]); this does not work

    then
    char tmp[2];
    sprintf(tmp, "%s", argv[3]);
    this does not work as well

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    argv[3][0] is the first char of the string.
    argv[3] is the whole string.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    17
    Quote Originally Posted by Salem View Post
    argv[3][0] is the first char of the string.
    argv[3] is the whole string.
    thank you very much.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Expected type for parameter 2, but found '_TCHAR'
    By juice in forum C Programming
    Replies: 1
    Last Post: 10-15-2013, 03:38 AM
  2. Questions regarding char *argv[ ]...
    By MikeyIckey in forum C Programming
    Replies: 7
    Last Post: 02-12-2009, 11:37 PM
  3. question regarding char *argv[]
    By cnb in forum C Programming
    Replies: 6
    Last Post: 10-08-2008, 04:50 AM
  4. when i would use char *argv[] and when char** argv[] ?
    By blue_gene in forum C Programming
    Replies: 17
    Last Post: 04-14-2004, 07:00 PM
  5. How to use int argc, char* argv[] ?
    By gogo in forum C++ Programming
    Replies: 3
    Last Post: 11-21-2001, 01:21 PM

Tags for this Thread