Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Other Forums > Chit-Chat


Chit-Chat Relax for a bit and have a general conversation (off topic is allowed!) with other members. Please be polite and respect your fellow members.

Reply
 
Thread Tools Display Modes
Old 21st February 2006, 09:35 PM   (permalink)
Experienced Member
 
danielsmusic is on a distinguished road
Send a message via MSN to danielsmusic
Default c++ convert argv[1] to a char array

is this posible, looking on google turned up nothing.
__________________
when you post that reply, im just kidding.
danielsmusic is offline   Reply With Quote
Old 22nd February 2006, 01:18 PM   (permalink)
Experienced Member
spirosd is on a distinguished road
Default

Code:
main(int argc, char *argv[])
{
 ......
}
Now, the separators for argv are os dependant but typically they are tabs or spaces so

one, two, and three => four strings
one,two, and three => three strings

If you want number parameters you would convert the string into a number using atoi() atof() ...

HTH
Spiros
spirosd is offline   Reply With Quote
Old 22nd February 2006, 02:20 PM   (permalink)
Experienced Member
MikeHibbett is on a distinguished road
Default

Can you explain your question a different way?

It is just that argv[1] is already a char array.

What is it that you wish to do?

Can you give us an example of your problem?

Mike.
__________________
www.drivesentinel.co.uk - Homebrew GPS Speed Camera Detectors
MikeHibbett is offline   Reply With Quote
Old 27th February 2006, 11:17 AM   (permalink)
akg
Experienced Member
 
akg is on a distinguished road
Default Re: c++ convert argv[1] to a char array

Quote:
Originally Posted by danielsmusic
is this posible, looking on google turned up nothing.
argc contains the nof arguments passed and argv[0]...argv[n] contains the different arguments.and itself char*
akg is offline   Reply With Quote
Old 18th March 2006, 01:07 PM   (permalink)
Experienced Member
 
danielsmusic is on a distinguished road
Send a message via MSN to danielsmusic
Default

well i wrote this fuction that needs a char array to work but just passing argv[2] doesnt work i wont compile i sayes it cannot convert it
__________________
when you post that reply, im just kidding.
danielsmusic is offline   Reply With Quote
Old 18th March 2006, 01:09 PM   (permalink)
Experienced Member
 
Styx is a jewel in the roughStyx is a jewel in the rough
Default

whats the code?
__________________
Nothing is impossible.
Once a problem is realised, the rest is just details


Styx is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes




All times are GMT. The time now is 05:47 AM.


Electronic Circuits  |  Radio Controlled
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.