467,858 Members | 1,489 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,858 developers. It's quick & easy.

Can one of you C guru's help me please???

Hello,

I am a new to this board and came here out of desparation....

I need to modifiy a C program to allow the workareas (there could be up to 30) it uses to be defined externally and passed to the C program, also I need to pass the lengths of the work areas.

I have exhausted my limited knowledge of C is there any of you folks that can provide some assistance.

I will tell you right now, i am one of those old dinosaurs that still writes programs in machine language and I guess C is just to modern for me to understand.

Thanks for any help provided.
Jul 11 '06 #1
  • viewed: 1446
Share:
2 Replies
Banfa
Expert Mod 8TB
ok the entry point of a C program is

Expand|Select|Wrap|Line Numbers
  1. int main( int argc, char **argp )
  2. {
  3.    /* Program code here */
  4. }
  5.  
argc gives the number of command line arguments and argp is an array of pointers to these arguments, note that the prgram name is always in the first one of these.

By processing the data in argc and argp you can pass data into a program at run time, so you can pass the sizes of your workareas on the command line, i.e.

MyProgram 1024 1024 2048 4096

This in main will result with

argc=5
argp[0]="MyProgram"
argp[1]="1024"
argp[2]="1024"
argp[3]="2048"
argp[4]="4096"

you can use strtoul to convert the strings to there binary values.
Jul 12 '06 #2
Banfa,

Thanks.. thats a good start.
Jul 12 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by Gabriel | last post: by
4 posts views Thread by Accolo1 | last post: by
3 posts views Thread by Richard | last post: by
2 posts views Thread by LJ | last post: by
3 posts views Thread by Michael Suess | last post: by
16 posts views Thread by Singulus | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.