By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,851 Members | 2,104 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,851 IT Pros & Developers. It's quick & easy.

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

P: 3
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
Share this Question
Share on Google+
2 Replies


Banfa
Expert Mod 5K+
P: 8,916
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

P: 3
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.