02-20-2009
How to pass an array from SHELL to C function
Hi,
I have an output generated from a shell script like;
0x41,0xF2,0x59,0xDD,0x86,0xD3,0xEF,0x61,0xF2
How can I pass this value to the C function, as below;
int main(int argc, char *argv[]) {
unsigned char hellopdu[]={above value};
}
Regards
Elthox
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have two shell variables $t1 and $t2 which I need to pass to a function in a shell script. The function will do some computation with those two variables and echo the resultant. But I do not know how to pass teh arguments.
The function written is
f1()
{......
........
}
What should... (3 Replies)
Discussion started by: preetikate
3 Replies
2. Shell Programming and Scripting
I want to pass an array in my function, And my function will be changing the elements of the array in the fuction, but it should not affect the values in my array variable of main function (1 Reply)
Discussion started by: ranjithpr
1 Replies
3. Shell Programming and Scripting
Hi
I need to pass an array to Awk script from Shell. Can you please tell how to do it? How to pass this array add_ct_arr to an awk script or access it in awk?
i=1
while ;
do
add_ct_arr=$(echo ${adda_count} | awk -v i=$i -F" " '{print $i;}')
echo ${add_ct_arr}
... (1 Reply)
Discussion started by: appsguy616
1 Replies
4. Shell Programming and Scripting
hi,
I have a array say
SAP_ARRAY="s1.txt"
SAP_ARRAY="s2.txt"
how can i pass this full array to a function.
here is the sample code i am using..
CHECK_NO_FILES()
{
FARRAY=$1
echo "FARRAY = $FARRAY"
echo "FARRAY = $FARRAY"
............... (5 Replies)
Discussion started by: Little
5 Replies
5. Shell Programming and Scripting
Hi, guys
I just wanted to sort the elements of an array ascendingly.
I know the following code does work well:
array=(13 435 8 23 100)
for i in {0..4}
do
j=$((i+1))
while ]
do
if } -le ${array} ]]
then :
else
min=${array}
${array}=${array}
${array}=$min
fi... (5 Replies)
Discussion started by: franksunnn
5 Replies
6. UNIX for Dummies Questions & Answers
How do i pass an array from test4.sh to a function in another shell script test5.sh, basically i am sourcing the test5.sh in test4.sh and printing the contents, but not working below are my trial scripts, please help, thank you.
#!/bin/bash
# /usr/local/dw/archive/test5.sh
print_array()
{... (5 Replies)
Discussion started by: Ariean
5 Replies
7. Shell Programming and Scripting
There are two parts to this. In the first part I need to read a list of files from a directory and split it into 4 arrays. I have done that with the following code,
# collect list of file names
STATS_INPUT_FILENAMES=($(ls './'$SET'/'$FOLD'/'*'in.txt'))
# get number of files... (8 Replies)
Discussion started by: LMHmedchem
8 Replies
8. Shell Programming and Scripting
Hi All
I have multiple arrays like below.
set -A val1 1 2 4 5
set -A val2 a b c d
.
.
.
Now i would like to pass the individual arrays one by one to a function and display/ do some action.
Note : I am using ksh
Can you please advise any solution...
Thanks in advance. (7 Replies)
Discussion started by: Girish19
7 Replies
9. Shell Programming and Scripting
Dear Friends,
Please help me on this
my script name is send.csh
In this i have written the statement like this
set args = ( city state country price )
I want to pass this array to another c shell called receiver.csh. and i want to use it in this c shell
or
how to pass to... (2 Replies)
Discussion started by: SA_Palani
2 Replies
10. Shell Programming and Scripting
I'm able to read & print an array in varaible called "filelist"
I need to pass this array variable to a function called verify() and then read and loop through the passed array inside the function.
Unfortunately it does not print the entire array from inside the funstion's loop.
#/bin/ksh... (5 Replies)
Discussion started by: mohtashims
5 Replies
SU(1) FSF SU(1)
NAME
su - run a shell with substitute user and group IDs
SYNOPSIS
su [OPTION]... [-] [USER [ARG]...]
DESCRIPTION
Change the effective user id and group id to that of USER.
-, -l, --login
make the shell a login shell
-c, --commmand=COMMAND
pass a single COMMAND to the shell with -c
-f, --fast
pass -f to the shell (for csh or tcsh)
-m, --preserve-environment
do not reset environment variables
-p same as -m
-s, --shell=SHELL
run SHELL if /etc/shells allows it
--help display this help and exit
--version
output version information and exit
A mere - implies -l. If USER not given, assume root.
AUTHOR
Written by David MacKenzie.
REPORTING BUGS
Report bugs to <bug-coreutils@gnu.org>.
COPYRIGHT
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU-
LAR PURPOSE.
SEE ALSO
The full documentation for su is maintained as a Texinfo manual. If the info and su programs are properly installed at your site, the com-
mand
info su
should give you access to the complete manual.
su (coreutils) 4.5.3 February 2003 SU(1)