[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]
Hi Thanks Gordon I did just what you said and it worked, thanks. Can you remember how to deal with comparing dates? dateadd? One thing i have been meaning to ask you is, in Asterisk is there a way of changing touch tone settings. I have found some users at work dial numbers to fast for the remote system to under stand, this is when they have to type a code to join a meeting i.e #234657# . Regards Sam ----- Original Message ----- From: "Gordon Henderson" <gordon+dcglug@xxxxxxxxxx> To: <list@xxxxxxxxxxxxx> Sent: Thursday, March 05, 2009 8:24 PM Subject: Re: [LUG] C++ Question > On Thu, 5 Mar 2009, Sam Grabham wrote: > >> Hi >> >> I have been trying to pass a string and a number via the command line, >> and then setting varibles for use later on in the code. >> >> When i pass say 23 as the second param i get a larger number set to >> "nMinutesIn" variable. If i cout << argv[2]; then i will get the 23 >> value, so if the argv[2] is a char type how do i convert to a int? > > atoi() l > > At least in C - it's been 10 years since I looked at c++ > > So: > > nMinutesIn = atoi (argv ([2]) ; > > atoi stands for ascii to integer. > > there are many other ways, but that's possibly the simplest. > > Gordon > >> >> I also would be greatfull for any advise for compairing dates, I want to >> create a funtion that acts like dateadd() function. >> >> I am finding it hard to find c++ generic sample code on the web, As lots >> of sample code is using windows apis etc. >> >> Anyone know of some good urls? >> >> my problem sample code below: >> >> int main(int argc, char *argv[]) >> { >> struct stat fileInfo; >> unsigned int nMinutesIn=0; >> string searchPath=""; >> >> searchPath = string(argv[1]); >> nMinutesIn = int(argv[2]); >> >> >> Regards >> >> >> Sam > > -- > The Mailing List for the Devon & Cornwall LUG > http://mailman.dclug.org.uk/listinfo/list > FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html -------------------------------------------------------------------------------- No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.0.237 / Virus Database: 270.11.8/1984 - Release Date: 03/04/09 19:17:00 -- The Mailing List for the Devon & Cornwall LUG http://mailman.dclug.org.uk/listinfo/list FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html