command line arguments and semi-colon

This is a discussion on command line arguments and semi-colon within the C Programming forums, part of the General Programming Boards category; Hi all, I've been playing around on a linux OS Ubuntu 9.04 and I wrote a small program that takes ...

  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    28

    command line arguments and semi-colon

    Hi all,
    I've been playing around on a linux OS Ubuntu 9.04 and I wrote a small program that takes in a string as an argument.

    The string is somewhat complicated so I terminate it with a ; (semi-colon) but for some reason (which I would like to know why) the ; doesn't appear part of the input string.

    For example:

    ./tst <string>;

    and my first line in the program is:

    printf("My argument is: %s\n", argv[1]);

    The semi-colon doesn't show in the string printed. However, if I use a comma , or some other character, it displays fine....

    Any ideas of why this is happening?

    thanks in advance

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Because ; means something to your shell, just like * means something to your shell and & means something to your shell....

  3. #3
    Registered User
    Join Date
    Apr 2010
    Posts
    28
    thanks tabstop!!!

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21