Sponsored Content
Full Discussion: Using argv argc
Top Forums Programming Using argv argc Post 67681 by Akeson Chihiro on Friday 25th of March 2005 05:26:44 AM
Old 03-25-2005
*argv oki

With the above code, using the strcat function, ptr2[0] = "..." , ptr2[1] is set to "null", etc... I have just found my error. I must "send" my params as an ARRAY Smilie .
Here is my new code, working well :

char param[150],location[100],*ptr,**ptrptr;
ptr = param;
ptrptr = &ptr;
ptrptr[0] = "wgrib";
ptrptr[1] = location;
ptrptr[2] = "-d";
ptrptr[3] = "0";
ptrptr[4] = "-text";
wgrib(5, ptrptr);

with int wgrib(int argc, char *argv[]) (or int wgrib(int argc, char **argv))

Thanks Smilie
 

10 More Discussions You Might Find Interesting

1. Programming

argv

I have a program which I wish to modify. It used to be run from the command line, but now I wish to change this so it can be used as a function. The program has complex argument processing so I want to pass my paramters to as if it were being called by the OS as a program. I have tried to... (2 Replies)
Discussion started by: mbb
2 Replies

2. Programming

dbx debugger + argv[argc]

Is it possible to use the dbx debugger with the CL options for the executable ? Say you have created a executable called myfunc which can take string arguments at run-time. You run it like this ./myfunc Hello World where Hello and World are the string arguments My question is whether... (1 Reply)
Discussion started by: JamesGoh
1 Replies

3. Programming

help for argv argc

Hi C experts, I have the following code for adding command line option for a program int main (argc, argv) int argc; char *argv; { char *mem_type; //memory type char *name; //name of the memory int addr; //address bits int data; ... (5 Replies)
Discussion started by: return_user
5 Replies

4. Programming

Building an argc/argv style structure from a string (char*)

Hello All, First post. I've been struggling with the following: Given a char* string, I need to construct an "int argc, char *argv" style structure. What I'm struggling with most is handling escaped-whitespace and quotes. e.g. the string: char *s = "hello world 'my name is simon'... (10 Replies)
Discussion started by: cbarwise
10 Replies

5. Programming

ARGV help in C

Hi, Can somehelp help how to list file in a dir? (5 Replies)
Discussion started by: Learnerabc
5 Replies

6. Programming

help with C, argv

when i run my program, i have a parameter, that i want to set the value to another string i am using int main(int argc, char **argv) { char my_str=argv; printf("%s",my_str); return 0; } and i get Segmentation fault ran using ./my_prog /usr/share/dict/words hello1 ... (2 Replies)
Discussion started by: omega666
2 Replies

7. Shell Programming and Scripting

ARGV and ARGC in bash 3 and bash 3.2

Hi Folks, I've prepared a shell script that takes action based on arguments and number of arguments..sample code like: ARGV=("$@") ARGC=("$#") case ${ARGV} in abc) if ; then ...... else printf "\nInvalid number of arguments, please check the inputs and... (2 Replies)
Discussion started by: SBC
2 Replies

8. Shell Programming and Scripting

argc/ argv in awk

Hi guys, i'm trying to solve this problem. I have to run something like cat file1.txt | awk -f script.awk 10 if i'm in the awk script, how can i take the parameter :10 ??:wall: i try something like : BEGIN{ var=argv } {..} END{..} but obviously is not correct... (5 Replies)
Discussion started by: heaven25
5 Replies

9. UNIX for Advanced & Expert Users

O argv, argv, wherefore art thou argv?

All of my machines (various open source derivatives on x86 and amd64) store argv above the stack (at a higher memory address). I am curious to learn if any systems store argv below the stack (at a lower memory address). I am particularly interested in proprietary Unices, such as Solaris, HP-UX,... (9 Replies)
Discussion started by: alister
9 Replies

10. Homework & Coursework Questions

Help using argc/argv in assignment

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: First, create a "hello world" program that prints "Hello World". But NOW, instead use argc to verify that a... (9 Replies)
Discussion started by: miniviking10
9 Replies
aa_parseoptions(3)					     Library Functions Manual						aa_parseoptions(3)

NAME
aa_parseoptions - parse the standard command line options used by AA-lib. SYNOPSIS
#include <aalib.h> int aa_parseoptions ( struct aa_hardware_params *p, aa_renderparams *r, int *argc, char **argv ); PARAMETERS
struct aa_hardware_params *p Hardware parameters structure to alter. It is expected that this structure only with necessary modifications will be later used to initialize the AA-lib context. aa_renderparams *r Rendering prameters structure to alter. It is expected that this structure only with necessary modifications will be later used to render images. int *argc Pointer to argc parameter passed to function "main". char **argv Pointer to argv parameter passed to function "main". DESCRIPTION
Use this function to parse the standard command line options used by AA-lib. Every AA-lib program ought to call this function to let user specify some extra parameters. The function alters the aa_hardware_params and aa_renderparams structures and removes known options from the argc/argv lists. It also parse the AAOPTS environment variable. When called with NULL for the argc/argv parameters, it parses AAOPTS only. At least this call ought to be in every AA-lib program. RETURNS
1 when sucesfull and 0 on failure. The program then can print the help text available in aa_help variable. SEE ALSO
save_d(3), mem_d(3), aa_help(3), aa_formats(3), aa_fonts(3), aa_dithernames(3), aa_drivers(3), aa_kbddrivers(3), aa_mousedrivers(3), aa_kbdrecommended(3), aa_mouserecommended(3), aa_displayrecommended(3), aa_defparams(3), aa_defrenderparams(3), aa_scrwidth(3), aa_scrheight(3), aa_mmwidth(3), aa_mmheight(3), aa_imgwidth(3), aa_imgheight(3), aa_image(3), aa_text(3), aa_attrs(3), aa_currentfont(3), aa_autoinit(3), aa_autoinitkbd(3), aa_autoinitmouse(3), aa_recommendhi(3), aa_recommendlow(3), aa_init(3), aa_initkbd(3), aa_initmouse(3), aa_close(3), aa_uninitkbd(3), aa_uninitmouse(3), aa_fastrender(3), aa_render(3), aa_puts(3), aa_printf(3), aa_gotoxy(3), aa_hidecursor(3), aa_showcursor(3), aa_getmouse(3), aa_hidemouse(3), aa_showmouse(3), aa_registerfont(3), aa_setsupported(3), aa_setfont(3), aa_getevent(3), aa_getkey(3), aa_resize(3), aa_resizehandler(3), aa_edit(3), aa_createedit(3), aa_editkey(3), aa_putpixel(3), aa_recommendhikbd(3), aa_rec- ommendlowkbd(3), aa_recommendhimouse(3), aa_recommendlowmouse(3), aa_recommendhidisplay(3), aa_recommendlowdisplay(3) c2man aalib.h 8 September 1999 aa_parseoptions(3)
All times are GMT -4. The time now is 05:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy