Perry Smith

Java Questions & Answers

Home / Java Q & A Archive Page 1 / Java Q & A Archive / Java Q & A Main Page

9-7-98

Turning argv[0] into an int

This is a basic question I can't find in any books. I am looking for the java eqiv of atoi() in c++. I need to take in a command line argument and use it as a string.

Thanks


Response
9-13-98

Re: Turning argv[0] into an int

uhh... I don't know what "atoi()" does but to turn the command line arguments into a string .. just use a loop that concatenates the separate arguments (but that has little to do with the topic of your question...)

To get one string with the command separated by spaces,

String strArgs;
for (int iLoop = 0;
i < java.lang.reflect.Array.getLength(argv);
i++)
{
strArgs = strArgs + argv[iLoop] + " ";
}

I don't know if this helps ....

Mike


Home / Java Q & A Archive Page 1 / Java Q & A Archive / Java Q & A Main Page