×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

argc argv in winmain

argc argv in winmain

argc argv in winmain

(OP)
Hi there,

How to get argc and argv with winmain ?

Thanks!
Tom

RE: argc argv in winmain

This comes out of an ancient copy of VC++:

int PASCAL WinMain(hinstCurrent, hinstPrevious, lpCmdLine, nCmdShow)

HINSTANCE hinstCurrent;    /* handle of current instance    */
HINSTANCE hinstPrevious;    /* handle of previous instance    */
LPSTR lpszCmdLine;    /* address of command line    */
int nCmdShow;    /* show-window type (open/icon)    */


The WinMain function is called by the system as the initial entry point for a Windows application.

Parameter    Description

hinstCurrent    Identifies the current instance of the application.
hinstPrevious    Identifies the previous instance of the application.
lpszCmdLine    Points to a null-terminated string specifying the command line for the application.

RE: argc argv in winmain

(OP)
I've implemented it about 5 days ago. Thanks for your feedback anyway. Best wishes.

RE: argc argv in winmain

Well, how did you do that?
I want to use the getopt module in order to retrieve the arguments out of the command-line. How can I do that?
As I see it, there are 2 options:
1. Get the argv/argc and use getopt.
2. Use some mechanism on Windows that I don't know about.

Erez

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources