- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
It would be very helpful if any of you can tell me If I can pass arguments to Main function in a C program using Nios II IDE, either using GUI or shell. I know how to run without arguments using both GUI and shell but I need help passing arguments. Thanks, AmjadLink Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I haven't done this myself, but in alt_main.c the arguments to main.c are passed.
024: /*
025: * Standard arguments for main. By default, no arguments are passed to main.
026: * However a device driver may choose to configure these arguments by calling
027: * alt_set_args(). The expectation is that this facility will only be used by
028: * the iclient/ihost utility.
029: */
030:
031: int alt_argc = 0;
032: char** alt_argv = {NULL};
033: char** alt_envp = {NULL};
...
116: main (alt_argc, alt_argv, alt_envp);
What exactly are you trying to accomplish? If you're looking for input arguments, why not keep it simple and use scanf()?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Thanks for the prompt reply. I will try it out.
I actually need to demonstrate buffer overflow attacks in embedded systems, which happens when you pass arguments with size more than the allotted memory.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm no security guru, but would a RPC suffice? Lots of embedded systems have TCP/IP stacks. I imagine RPCs are a simple way to control an embedded device.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page