Advertisement Jump to content


This topic is now archived and is closed to further replies.


Extracting command line arguments from LPSTR?

This topic is 6400 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone know how to do this? program.exe level.bsp In the above example LPSTR is supposed to be a pointer to the char* '' level.bsp''. I can''t seem to scan the characters. Paulcoz.

Share this post

Link to post
Share on other sites
Hmmm. What do you mean by scan them?

LPSTR is a typedef for char*.

Assuming you are getting this information from WinMain you treat it just like any other string. The actual argument is lpCmdLine not LPSTR. (If you let MSVC generate your WinMain that is...)

lpCmdLine[0] == ''l''
lpCmdLine[1] == ''e''
lpCmdLine[2] == ''v''
lpCmdLine[3] == ''e''


Multiple arguments will be seperated by spaces.

What problem are you having accessing it?


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!