09-09-2013
In the main() function it's an array. In the p_array() function it's a pointer to the first element of the array.
I didn't see where you passed len to p_array(), or how it was used there, so I can't comment on it.
10 More Discussions You Might Find Interesting
1. Programming
Hi all,
I am trying to create a function that return an array of integer based on the char parameter pass into the function. I.e.
func_a(char * str)
{
example str is equal to "1,2,3,4"
return an array of integers of 1,2,3,4
}
Please advise
regards
dwgi32 (2 Replies)
Discussion started by: dwgi32
2 Replies
2. Shell Programming and Scripting
Hi experts,
How to get the length of an Array in PERL.
for eg., @Var having 5 elements.
regards
Anent (5 Replies)
Discussion started by: anent
5 Replies
3. UNIX for Advanced & Expert Users
Hello. I'm working on a project that involves creating public/private keys server-side using openssl and using the public key in a Javascript application to encrypt sensitive data in form fields before transmission to the server. Using an SSL https server connection was not an option in this... (1 Reply)
Discussion started by: jhopper
1 Replies
4. Shell Programming and Scripting
I need to implement the following logic and need some expert help from UNIX community.
These are the steps in my Shell script.
1. Analyze a file.
2. Extract all the ID's in that file.
3. Use the ID's from #2 to run another filter on the file.
I've implemented # 1 and 2 using... (3 Replies)
Discussion started by: katwala
3 Replies
5. Shell Programming and Scripting
Hi !
I'm looking for a way to transform certain floating point numbers in a one-line, variable length file to integers.
I can do this in a crude way with sed :
sed -e 's/0\.\(\):/\1:/g' -e 's/0\.0\(\):/\1:/g' -e 's/1\.000:/100:/g' myfile ... but this doesn't handle the rounding correctly.
... (3 Replies)
Discussion started by: jossojjos
3 Replies
6. Shell Programming and Scripting
As Brendan O'Conner writes in this blog, mawk is near 8 times faster than gawk, so I am going to give mawk a go, but I got errors when trying to print the length of an array in mawk using length() function, is it not supported in mawk? or there's another way to get the length of an array in mawk?
... (3 Replies)
Discussion started by: kevintse
3 Replies
7. Shell Programming and Scripting
I would be grateful if someone could help me. I am trying to write a .sh script in UNIX.
I have the following code;
User=john
User=james
User=ian
User=martin
for x in ${User}
do
print ${#x}
done
This produces the following output;
4
5
3
6 (12 Replies)
Discussion started by: mmab
12 Replies
8. Shell Programming and Scripting
Hello All,
I have this script that does stuff like "starting, stopping & restarting" a Daemon Process running on my machine...
My main question is why in part of my code (which you will see below) does the Array Length (i.e. ${#PIDS} )
return "1" when I know the Array is empty..?
Here is... (17 Replies)
Discussion started by: mrm5102
17 Replies
9. Shell Programming and Scripting
Does anyone know how to find length of multi dimension array
of following type
A Afor simple array I is to do
for (i in A)n++ to find length of array but if it is multi dimension how to find the length ? (2 Replies)
Discussion started by: nex_asp
2 Replies
10. UNIX for Beginners Questions & Answers
Hi there,
I'm listing files and sorting them. When I try to get length of array variable in which these files are stored I get 1 as value. That's weird.
files_info="$(find $input_dir -name "*_CHR$i.info" | sort )"
printf ${#files_info}"\n" #print length
#--loop through... (6 Replies)
Discussion started by: genome
6 Replies
LEARN ABOUT FREEBSD
backtrace_symbols_fd
BACKTRACE(3) BSD Library Functions Manual BACKTRACE(3)
NAME
backtrace -- fill in the backtrace of the currently executing thread
LIBRARY
library ``libexecinfo''
SYNOPSIS
#include <execinfo.h>
size_t
backtrace(void **addrlist, size_t len);
char **
backtrace_symbols(void * const *addrlist, size_t len);
int
backtrace_symbols_fd(void * const *addrlist, size_t len, int fd);
char **
backtrace_symbols_fmt(void * const *addrlist, size_t len, const char *fmt);
int
backtrace_symbols_fmt_fd(void * const *addrlist, size_t len, const char *fmt, int fd);
DESCRIPTION
The backtrace() function places into the array pointed by addrlist the array of the values of the program counter for each frame called up to
len frames. The number of frames found (which can be fewer than len) is returned.
The backtrace_symbols_fmt() function takes an array of previously filled addresses from backtrace() in addrlist of len elements, and uses fmt
to format them. The formatting characters available are:
a The numeric address of each element as would be printed using %p.
n The name of the nearest function symbol (smaller than the address element) as determined by dladdr(3) if the symbol was dynamic, or
looked up in the executable if static and the /proc filesystem is available to determine the executable path.
d The difference of the symbol address and the address element printed using 0x%tx.
D The difference of the symbol addresss and the address element printed using +0x%tx if non-zero, or nothing if zero.
f The filename of the symbol as determined by dladdr(3).
The array of formatted strings is returned as a contiguous memory address which can be freed by a single free(3).
The backtrace_symbols() function is equivalent of calling backtrace_symbols_fmt() with a format argument of %a <%n%D> at %f
The backtrace_symbols_fd() and backtrace_symbols_fmt_fd() are similar to the non _fd named functions, only instead of returning an array or
strings, they print a new-line separated array of strings in fd, and return 0 on success and -1 on failure.
RETURN VALUES
The backtrace() function returns the number of elements that were filled in the backtrace. The backtrace_symbols() and
backtrace_symbols_fmt() return a string array on success, and NULL on failure, setting errno. Diagnostic output may also be produced by the
ELF symbol lookup functions.
SEE ALSO
dladdr(3), elf(3)
HISTORY
The backtrace() library of functions first appeared in NetBSD 7.0 and FreeBSD 10.0.
BUGS
1. Errors should not be printed but communicated to the caller differently.
2. Because these functions use elf(3) this is a separate library instead of being part of libc/libutil so that no library dependencies are
introduced.
3. The Linux versions of the functions (there are no _fmt variants) use int instead of size_t arguments.
BSD
August 23, 2013 BSD