05-08-2013
Better "The address in pointer argv points to memory containing an array of pointers, each pointing to memory containing a character array, except the last (highest) pointer in the array is null." The argv pointer is stored on the call stack as a parameter, first bit of memory, points to the array of pointers, second bit of memory, and if there are, say, 5 pointers in the array, 4 point to additional areas of memory with null terminated character arrays, and the 5th, highest is set to zeros (null). For instance, &argv might be 0xFFFFE078, containing a heap address 0x00031244, and the array of pointers is in 0x00031244-57 inclusive. The first pointer in 0x00031244-7 might be 0x00030711. The first character array may occupy 0x00030711-5, loaded with "haha", 4 char and a null.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
say I have a IP address which is 10.0.0.12, and subnet mask is 255.255.255.240, what is the network address and what is the broadcast address which host lives on?
And could you explain how to get the answer?
thanx in advance! (7 Replies)
Discussion started by: pnxi
7 Replies
2. IP Networking
Hi sir,
i want to make such programe which takes MAC(Ethernet) address of any host & give me its IP address.......
but i'm nt getting that how i can pass the MAC address to Frame........
Please give me an idea for making such program...
Thanks & regards
Krishna (3 Replies)
Discussion started by: krishnacins
3 Replies
3. Programming
How do I get a pointer to any 32 bit address on my hard drive, in which I then could read that memory or write to that memory address?
And, while the subject is on, how do get a 32 bit pointer in RAM also, in which I can do the same?
I'm using C and Objective-C with gcc on an iBook G4.
A... (9 Replies)
Discussion started by: xcoder66
9 Replies
4. Programming
Hi i'm new to c programming and i'm trying to change the address of a pointer/variable but i can't seem to get it right,
I have this
char heap;
char *firstFree = heap;
char *allocMem( int size ) {
void *malloc(size_t sizeofint);
/*allocate space for an array with size... (19 Replies)
Discussion started by: Poison Ivy
19 Replies
5. Programming
If one wants to get a start address of a array or a string or a block of memory via a function, there are at least two methods to achieve it:
(1) one is to pass a pointer-to-pointer parameter, like:
int my_malloc(int size, char **pmem)
{
*pmem=(char *)malloc(size);
if(*pmem==NULL)... (11 Replies)
Discussion started by: aaronwong
11 Replies
6. Shell Programming and Scripting
Trying to do a ksh script that needs to list all ip address between ip address a and b ..
ie.
Ip address A=192.168.1.200
Ip address B=192.168.2.15
So the subnet changes from 1 to 2 but I want to list all possible ip addresses between the 2..
Which would be:
192.168.1.200... (4 Replies)
Discussion started by: frustrated1
4 Replies
7. UNIX for Dummies Questions & Answers
:) Firstly Hi all!!, im NEW!! and on here hoping that someone might be able to offer me some help... i have a server that keeps crashing every few days with the error message:
PANIC KERNAL-MODE ADDRESS FAULT ON USER ADDRESS 0X14
KERNAL PAGE FAULT FROM (CS:EIP)=(100:EF71B5BD)
EAX=EF822000... (10 Replies)
Discussion started by: Twix
10 Replies
8. IP Networking
Hi there
I lost connectivity to one of our remote systems and when I checked the messages log I found the following:
Aug 10 23:42:34 host xntpd: time reset (step) 1.681729 s
Aug 16 13:20:51 host ip: WARNING: node "mac address" is using our IP address x.x.x.x on aggr1
Aug 16 13:20:51 host... (9 Replies)
Discussion started by: notreallyhere
9 Replies
9. UNIX for Dummies Questions & Answers
How can I print the memory address of a pointer using printf (or any other STDOUT functions?). I see in Linux its %p but not in unix, help?
thanks (5 Replies)
Discussion started by: perleo
5 Replies
10. UNIX for Advanced & Expert Users
Hi ,
Could someone let me know how to detect duplicate ip address after assigning ip address to ethernet interface using c program (3 Replies)
Discussion started by: Gopi Krishna P
3 Replies
EXECL(3) Library Functions Manual EXECL(3)
NAME
execl, execv, execle, execlp, execvp, exec, execve, exect, environ - execute a file
SYNOPSIS
execl(name, arg0, arg1, ..., argn, 0)
char *name, *arg0, *arg1, ..., *argn;
execv(name, argv)
char *name, *argv[];
execle(name, arg0, arg1, ..., argn, 0, envp)
char *name, *arg0, *arg1, ..., *argn, *envp[];
exect(name, argv, envp)
char *name, *argv[], *envp[];
extern char **environ;
DESCRIPTION
These routines provide various interfaces to the execve system call. Refer to execve(2) for a description of their properties; only brief
descriptions are provided here.
Exec in all its forms overlays the calling process with the named file, then transfers to the entry point of the core image of the file.
There can be no return from a successful exec; the calling core image is lost.
The name argument is a pointer to the name of the file to be executed. The pointers arg[0], arg[1] ... address null-terminated strings.
Conventionally arg[0] is the name of the file.
Two interfaces are available. execl is useful when a known file with known arguments is being called; the arguments to execl are the char-
acter strings constituting the file and the arguments; the first argument is conventionally the same as the file name (or its last compo-
nent). A 0 argument must end the argument list.
The execv version is useful when the number of arguments is unknown in advance; the arguments to execv are the name of the file to be exe-
cuted and a vector of strings containing the arguments. The last argument string must be followed by a 0 pointer.
The exect version is used when the executed file is to be manipulated with ptrace(2). The program is forced to single step a single
instruction giving the parent an opportunity to manipulate its state. On the VAX-11 this is done by setting the trace bit in the process
status longword. Exect is not available on the PDP-11.
When a C program is executed, it is called as follows:
main(argc, argv, envp)
int argc;
char **argv, **envp;
where argc is the argument count and argv is an array of character pointers to the arguments themselves. As indicated, argc is convention-
ally at least one and the first member of the array points to a string containing the name of the file.
Argv is directly usable in another execv because argv[argc] is 0.
Envp is a pointer to an array of strings that constitute the environment of the process. Each string consists of a name, an "=", and a
null-terminated value. The array of pointers is terminated by a null pointer. The shell sh(1) passes an environment entry for each global
shell variable defined when the program is called. See environ(7) for some conventionally used names. The C run-time start-off routine
places a copy of envp in the global cell environ, which is used by execv and execl to pass the environment to any subprograms executed by
the current program.
Execlp and execvp are called with the same arguments as execl and execv, but duplicate the shell's actions in searching for an executable
file in a list of directories. The directory list is obtained from the environment.
FILES
/bin/sh shell, invoked if command file found by execlp or execvp
SEE ALSO
execve(2), fork(2), environ(7), csh(1)
DIAGNOSTICS
If the file cannot be found, if it is not executable, if it does not start with a valid magic number (see a.out(5)), if maximum memory is
exceeded, or if the arguments require too much space, a return constitutes the diagnostic; the return value is -1. Even for the super-
user, at least one of the execute-permission bits must be set for a file to be executed.
BUGS
If execvp is called to execute a file that turns out to be a shell command file, and if it is impossible to execute the shell, the values
of argv[0] and argv[-1] will be modified before return.
4.2 Berkeley Distribution August 4, 1987 EXECL(3)