Programming :: How To Get The Total Arguments In Perl

Jan 6, 2010

How can I get the total arguments in perl.To be more specific if I try to execute the command

Code:
perl -w myperl.pl ash ok kumar

I should be able to get all the command line arguments.

I know that @ARGV will store only the arguments passed but not the entire arguments.

View 14 Replies


ADVERTISEMENT

Programming :: Threads Not Getting Arguments Properly

Mar 26, 2011

I wrote a C program using Pthreads to compute the product of 2 matrices. Each element in the product matrix is computed in a separate thread. Eg: Thread (i,j) computes the element C[i][j] of the matrix C, where C=A*B. A is m*n, B is n*p, C is m*p. m,n,p are given as command-line arguments. A and B are initialized to random values from 1 to 10, while all elements of C are initialized to -1.But some threads do not get their arguments (i,j) correctly. So some elements C[i][j] still remain as -1, even after the program is over. My OS is Ubuntu 10.10 (Maverick Meerkat) 32-bit.I ran the program on another computer and it worked correctly. Is it due to a problem in the Pthreads library in my OS? Please help me. I have attached the source code.

View 3 Replies View Related

Programming :: Pass In Mandatory Arguments First?

Jun 9, 2011

I am using getopts to take parse optional arguments but i also pass in mandatory arguments first

[code]
#!/bin/bash
print_usage()
{
perror "$@"
}
arg1="$1"
arg2="$2"
shift 2
[Code]....

View 8 Replies View Related

Programming :: Insufficient Arguments While Running A Script

Mar 24, 2010

I have a script gdrGltoDataRefresh.sh .while try to run the script it's giving:

And in log file it's giving:

View 5 Replies View Related

Programming :: Set For A Group Of Command Line Arguments?

Oct 11, 2010

i was wondering if someone could help me figure out a script for global variables i'm trying to set for a group of command line arguments:

basically i'm trying to set: if $# = 3 then i want to search for each all string $1 $2 $3

if $# = 4

then i want to search for each all string $1 $2 $3 $4

View 2 Replies View Related

Programming :: Bash Reading Arguments, Most Effective Way?

Aug 17, 2010

I've been reading about getopt and getopts but it doesn't seem like it's possible to parse arguments like --foo or even -foo. I've started my own script trying to achieve this, but I'm still wondering if I'm losing performance and if there is a better way to do this task.

Also I'm using the [[ =~ ]] regex syntax which seems to be available only in newer bash versions, should it be a big issue? My bash version: GNU bash, version 4.1.7(2)-release (x86_64-unknown-linux-gnu)

[Code]...

View 6 Replies View Related

Programming :: C Arguments To Main - Can't Compare Values?

Jul 24, 2011

Whats wrong with this:

Code:
#include <stdio.h>
int main(int argc, char *argv[])
{
if(argv[4] == "-verbose")
{
printf("Verbose is on");

[Code]...

View 2 Replies View Related

Programming :: Hidtouch__body.h:174: Error: Too Few Arguments To Function

Oct 9, 2010

I'm trying to compile the hidtouch driver, but hit a snag. The error I get is

[code]....

Context: this is the driver for the touchscreen attached to an LTSP client. The server uses the AMD64 arch, the client uses the 1386 arch, both Debian. The client does start, but lacking a pointer device the pointer is useless. The build takes place on the server, in the i386 chroot of the LTSP setup. Basically, I'm stuck now...

View 5 Replies View Related

Programming :: Function Pointers With Variable Arguments

Jul 14, 2011

I need to call functions that match an input string (if input str = "func1", call func1), so I have this:

Code:
#include <stdio.h>
#include <string.h>
void function_a(void) { printf("Function A
"); }

[Code].....

In the above example, the functions take no input arguments. Can they take a different number of arguments, for example, function_a(int), function_c(int, int), function_e(int, char, int)? How can I do that?

View 3 Replies View Related

Programming :: Pass Arguments To A Function Using A Loop

Mar 1, 2010

I need to pass a large number of arguments to a function which takes variable number of arguments, such as gtk_list_store_new. But it doesn't look nice if i write something like gtk_list_store_new(NUM,TYPE_A,TYPE_B,TYPE_C,...,TYPE_OMEGA); because of large number of arguments. And, it will be a trouble to change number of columns because of need to manually change arguments to large number of such functions. So, how can i pass all the arguments to a function using a loop? Something like

Code:
for(i=0;i<NUM;i++)
{
push_arg(args[i]);
}
call_function(func);
?

Of course, i could just use asm code for this, but is there a portable way of doing so?

P.S. i mean C language.

View 2 Replies View Related

Programming :: Pass Arguments To Binary Cgi Program?

Mar 5, 2010

My hosting server does not allow exec() or system() calls, for security reasons. I can call a cgi process in two ways. From a .shtml page, i can issue a directive like code...

View 11 Replies View Related

Programming :: Parsing Command Line Arguments In PHP?

Feb 1, 2010

I want to know how to get eg. the contents of a form on a webpage which has been passed to a server side PHP script, inside for example an array which I can read. I've been reading a ebook on PHP which as far as I can see doesn't cover this inside it.

View 1 Replies View Related

Programming :: Passing Arguments To A Child Process In C++?

Feb 7, 2010

what I am trying to do is to pass an argument to the standard input stream of a child process. I mean I create two programs .. first one invokes the other. second one contains something like

Code:

scanf("%d", &n);

now I want my first program to be able to pass a value to the second one so that it gets stored in n.

View 7 Replies View Related

Programming :: Passing Arguments To System Command?

Dec 17, 2009

I am calling another executable in my application (C programing) using "system" command
which is user interactive program. now i want to pass those args in system command only.

system(" executable ");

Executable will expect 1,2 or 3.

1 is to continue
2 for do changes in settings
3 exit from application

how to pass these in to system command

View 1 Replies View Related

Programming :: Syntax For Passing Arguments In Csh Aliases?

Mar 22, 2009

I want to write a little time-saving alias for my .cshrc file that will move files and then cd to the directory I've moved them to. What I can't quite figure out is the syntax to say 'move all the arguments except the last one.' Here is what I have:

alias follow 'mv !:1-$-1 !:$; cd !:$'

This actually seems to work, but it also gives me an irritating error:

mv: cannot stat `destinationdirectory/-1': No such file or directory

Similarly, I tried:

alias follow 'mv !:*$#argv-1 !:$; cd !:$'

Again the move and cd are successful, but again there is an error:

mv: cannot stat `destinationdirectory/0-1': No such file or directory

View 1 Replies View Related

Programming :: PHP - Total Disk Quota For User

Nov 22, 2010

I am writing a php script and I need to find the total diskspace of a directory. I have used space already. I have a couple of different users with quotas
Code:
$path = "/home/" . ($_SERVER['PHP_AUTH_USER']);
$used = exec("du -c -a $path");
echo $used;
Will give me the disk space used. But I need total quota for that user.

View 4 Replies View Related

Programming :: C - Adding Up Array Column Total?

Jan 25, 2010

I'm having problems adding up column totals using arrays. I've got it to add up the row totals and display at the end of the row. Here is my code so far

Code:

#include <stdio.h>
#include <string.h>
const int maxrows=10;

[code]...

What i need it to do is, add up the columns and display it at the bottom of each column similar to how the row totals display

View 2 Replies View Related

Programming :: Total Amount Of Allocated SHM Memory?

Aug 25, 2010

Is there an easy way in C to get the total amount of allocated SHM memory on a machine?

View 7 Replies View Related

Programming :: Passing Arguments To A Bash Source File?

Apr 24, 2010

Is it possible to pass arguments to a source file in a bash script? For example

#!/bin/sh
#
. /dir1/dir1/funclib -a -b

How would you check for the passed arguments in funclib without getting confused with any arguments passed to the main script?

View 5 Replies View Related

Programming :: Read Multiple Arguments In Bash Script?

Nov 24, 2010

First, I made a simply script which let me download a file from a filehosting site on my server, but I can only put one link there, so I need help how to put multiple links in.Here is my script:

Code:
#!/bin/bash
echo "Enter URL:"

[code]...

View 3 Replies View Related

Programming :: Running A Program With Arguments Using A Shell Script

Jul 14, 2011

Running a program with arguments using a shell script

View 1 Replies View Related

Programming :: C Syntax - Passing In Unknown Number Of Arguments?

May 18, 2009

I need to write a wrapper function around the mvprintw function, like so:

int smvprintw( ? )
{
// Do various checks/modifications on the first two arguments (int y,
int x) first,
// and then
return mvprintw ( ? );
}

How should I write the args for smvprintw so that I can pass all the data correctly to mvprintw, and also do my checks on the first two args (for example, to modify them)? I'm confused by the prototype of mvprintw: This is mvprintw as listed in the man pages:

int mvprintw(int y, int x, const char *fmt, ...);

And this is how I saw it in ncurses.h:

extern NCURSES_EXPORT(int) mvprintw (int,int, const char *,...)

I believe the "..." refers to the unknown number of items after const char * fmt. Will it suffice to do something like "int smvprintw(int y, int x, const char * fmt, void * etc)" and then "mvprintw(y, x, fmt, etc)" inside the function?

View 2 Replies View Related

Programming :: Case Statement Passing Multiple Arguments?

Aug 7, 2010

I've started dabbling with the case statement in order to pass some option's arguments into variables. I do not think I am doing this right.

Code:

usage() {
echo "Usage: $0 [-z|--snooze] [-c|--channel] [-p|--playlist]
[-m|--message] [-v|--mpcvolume]"

[code]....

As you can see, I want to pass arguments depending on the option(s) chosen by the user; ie. --snooze, or --channel. By default, if no options are chosen, I'll display a usage message; though in the future I'll provide some sane defaults. I'd like to create a case statement to handle passing arguments to any number of options; something like:

Code:

wakethehellup.sh --snooze 20 --message 'wake up!'

and for the other arguments, it would have a default set. The case statement I provided fails with a syntax error "syntax error near unexpected token `$2'" near the '--snooze' in the statement, so I take it you can't pass a parameter in this way; but I'm confused as to how I'm supposed to pass different parameters to different options without the options being confused as parameters.

View 2 Replies View Related

Programming :: Make 2 Separate Arguments In 1 Bash Script?

Aug 31, 2010

This is what I have:

Code:
#!/bin/bash
#ascript.sh

[code]...

View 8 Replies View Related

Programming :: Scalar Arguments - Changes Reflected In Calling Program

Dec 3, 2010

(For function arguments): Scalar arguments are passed by value, which means that a copy of the argument is made for processing in the function, and changes to the argument in the function won't be reflected back to the calling program. Objects though, are passed by reference: any changes to them in the function are reflected in the calling program. What sense does this make? Why have they done this?

View 3 Replies View Related

Programming :: Bash Script : Pass Arguments To Second Level Parser?

Jan 14, 2011

I wrote a C++ program that uses two different parsers. The first parser is reading program arguments from command line:./mybin arg1 arg2 ...then during program execution there's an interactive prompt asking for more parameters:

...
>> (second bunch of arguments here)
...

I'd like to run my program inside a bash script, but I don't know how to give the second level arguments.

View 2 Replies View Related

Programming :: Passing Command-line Arguments To Qglviewer Application?

Jul 13, 2009

how to use QGLviewer. I want to give my program a file name as a command line argument. All of the sample programs I find have a main.cpp file like this:

Quote:

#include <QApplication>
#include "window.h"
int main(int argc, char *argv[])

[code]....

Then the Window class, which is derived from QGLViewer, does all the program's actual work. If I want access to argc and argv, for example, to open and read a file that's passed as an argument, what would handle that? Is there a built-in way to get the arg variables to the window class, or do I need to just write a loadfile function and pass them?

View 1 Replies View Related

Debian Programming :: How To Find Total Size Of A List Object In Byte

Jan 11, 2013

Assuming there are two list objects a1, a2.

a1 = ['
']
a2 =['hi
']

len() built-in function gives total number of elements in the list object.
len(a1) gives 1. len(a2) gives 1 also.

Code: Select all$ python
Python 2.7.3 (default, SepĀ  9 2012, 17:41:34)
[GCC 4.7.1] on linux2

[Code]......

I thought there exists a built-in function that gives total size of a list object in byte. So using the function produces 1 for a1, 3 for a2. I haven't found such function or module yet.

View 3 Replies View Related

Programming :: Write A Script To Calculate The Total Amount Of Installed Memory?

Apr 4, 2011

I am trying to write a script to calculate the total amount of installed memory to use during an anaconda kickscript, so the swap file is created at 2 x the installed memory. I so far have the amount of installed RAM DIMMS but need a way to total them up and produce a varible I can use in the pre section of the install.

Code:

dmidecode -t 17 | grep Size | awk ' { print $2 }'
Output:
2048
2048

Note: on some servers there could be from 1 DIMM up to 16 DIMMS installed so the script needs to be able to handle this. I also can not use bc as it does not exist during the install stage. I am guessing I need a while loop to do this and use expr but do not know where to start for this logic.

View 3 Replies View Related

Programming :: Socket Programming In Module Perl

Jul 21, 2010

Where is the perl module for programming with sockets?

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved