View Full Version : Problem on reading the command line

11-05-2001, 07:58 AM
Hello all, I am a beginner to win32 programming and OpenGL.
Now having a problem about reading the command line, hope anyone would help.

I am writing a win32 program that reads a file on the command line.
The file contains vertex informations to draw with OpenGL.

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)

Let's say my program is named "draw.exe" and I'd like to read the file "data.txt".
So I run "draw.exe data.txt".

How can I make the lpCmdLine becomes a character string? so that I can manipulate it with simple C++ commands?
fopen(lpCmdLine, "r") fails to work.

or is there a way that I can convert the data type LPSTR to char string?

Thanks a lot!

11-05-2001, 09:11 AM
It is already string. http://www.opengl.org/discussion_boards/ubb/rolleyes.gif

11-06-2001, 08:51 AM
Thanks a lot!

I have figured it out already now!