Sponsored Content
Top Forums Programming Combining multiple command line arguments Post 302305752 by hansel13 on Thursday 9th of April 2009 04:05:31 PM
Old 04-09-2009
Thank you, that clears it up. Everything works now...

Code:
int main(int argc, char* argv[])
{
    int i = 1;

    for(i = 1; i < argc; i++)
    {
        if(i > 1)
        {
            argv[i] = strncat(argv[i - 1],argv[i],1000);
        }
        printf("%s\n\n", argv[i]);
    }
    printf("Printing string: %s\n", argv[i - 1]);
    printf("The sentence entered is %u characters long.\n",strlen(argv[i - 1]));
    return 0;
}

 

10 More Discussions You Might Find Interesting

1. Programming

command line arguments

Hi How to pass multi line text as a command line argument to a program. (i.e) ./a.out hi this is sample 0 file1 where hi this is sample should be stored in argv 0 in argv and so on... (3 Replies)
Discussion started by: bankpro
3 Replies

2. UNIX for Dummies Questions & Answers

arguments in command line

Hi all, How many arguments can we pass while testing a prgm at command line.. I encountered an issue while passing 10 arguments. For $10 its taking argument passed for $1 followed by 'zero'. can we pass more than 9 arguments /Is there any other way. Thanks, rrs (6 Replies)
Discussion started by: rrs
6 Replies

3. Shell Programming and Scripting

command line arguments

-------------------------------------------------------------------------------- I have this while loop and at the end I am trying to get it to tell me the last argument I entered. And with it like this all I get is the sentence with no value for $1. Now I tried moving done after the sentence... (1 Reply)
Discussion started by: skooly5
1 Replies

4. UNIX for Dummies Questions & Answers

Command line arguments.

I am working on a script wherein i need the user to enter the Build ID for eg:the command line will show enter the build ID Now on entering the build ID it should be assigned to @ARGV. How can this be done.? (1 Reply)
Discussion started by: Varghese
1 Replies

5. UNIX for Dummies Questions & Answers

command line arguments

hi, can someone how to accept command line arguments as a variable using in script? like: ./scriptname arguments by accept arguments, I can use it in my script? thx! (1 Reply)
Discussion started by: ikeQ
1 Replies

6. Shell Programming and Scripting

command line arguments

hi,,,, I want to create a command prompt, for example "prompt>", so my prompt need to handle commands, for example "prompt>cmd", so i want to know how to get arguments for my own commands cmd, i.e. default argc should contain arguments count and argv should point to the argument vector i.e, for... (2 Replies)
Discussion started by: vins_89
2 Replies

7. Programming

PERL:Combining multiple lines to single line

Hi All I need a small help for the below format in making a small script in Perl or Shell. I have a file in which a single line entries are broken into three line entries. Eg: I have a pen and notebook. All i want is to capture in a single line in a separate file. eg: I have a pen and... (4 Replies)
Discussion started by: Kalaiela
4 Replies

8. Shell Programming and Scripting

Command line arguments with multiple values

how can I pass multiple values from command line arguments example script.sh -arg1 op1 -arg2 op1 op2 op3 (2 Replies)
Discussion started by: nsk
2 Replies

9. Shell Programming and Scripting

Processing Multiple Arguments in Command Line Options

Hi All, I am new to scripting. Could you please assist me . Here is my requirement. I have written a script that has 2 option flags defined. -l) calls some function with the arguments passed in front of -l -r) calls second function with the arguments passed in front of -r *) calls the... (7 Replies)
Discussion started by: Jay Deshpande
7 Replies

10. Shell Programming and Scripting

Combining multiple block of lines in one comma separated line

Hi Everyone, On my Linux box I have a text file having block of few lines and this block lines separated by one blank line. I would like to format and print these lines in such a way that this entire block of lines will come as single comma separated line & again next block of lines in next... (7 Replies)
Discussion started by: gr8_usk
7 Replies
CATAN(3)						     Linux Programmer's Manual							  CATAN(3)

NAME
catan, catanf, catanl - complex arc tangents SYNOPSIS
#include <complex.h> double complex catan(double complex z); float complex catanf(float complex z); long double complex catanl(long double complex z); Link with -lm. DESCRIPTION
The catan() function calculates the complex arc tangent of z. If y = catan(z), then z = ctan(y). The real part of y is chosen in the interval [-pi/2,pi/2]. One has: catan(z) = (clog(1 + i * z) - clog(1 - i * z)) / (2 * i) VERSIONS
These functions first appeared in glibc in version 2.1. CONFORMING TO
C99. EXAMPLE
/* Link with "-lm" */ #include <complex.h> #include <stdlib.h> #include <unistd.h> #include <stdio.h> int main(int argc, char *argv[]) { double complex z, c, f; double complex i = I; if (argc != 3) { fprintf(stderr, "Usage: %s <real> <imag> ", argv[0]); exit(EXIT_FAILURE); } z = atof(argv[1]) + atof(argv[2]) * I; c = catan(z); printf("catan() = %6.3f %6.3f*i ", creal(c), cimag(c)); f = (clog(1 + i * z) - clog(1 - i * z)) / (2 * i); printf("formula = %6.3f %6.3f*i ", creal(f2), cimag(f2)); exit(EXIT_SUCCESS); } SEE ALSO
ccos(3), clog(3), ctan(3), complex(7) COLOPHON
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. 2011-09-15 CATAN(3)
All times are GMT -4. The time now is 08:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy