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
 
Tools
Old 21st February 2006, 10:35 PM   #1
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  
Old 22nd February 2006, 02:18 PM   #2
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  
Old 22nd February 2006, 03:21 PM   #3
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  
Old 27th February 2006, 12:18 PM   #4
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  
Old 18th March 2006, 02:07 PM   #5
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  
Old 18th March 2006, 02:09 PM   #6
Default

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


Styx is offline  
Reply

Tags
argv1, array, char, convert

Thread Tools
Display Modes




All times are GMT. The time now is 06:35 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker