D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] C++ Question

 

On Thu, 5 Mar 2009, Sam Grabham wrote:

> Hi
>
> Thanks Gordon
>
> I did just what you said and it worked, thanks.
>
> Can you remember how to deal with comparing dates? dateadd?

A lot will depend on how you store them. I always prefer unix timestamps 
(ie. 32-bit integer) but if you've got them as strings, then there's a 
million and one ways to represent them unless you force a certian format - 
even then, fif you're dealing with the international market - is is 
day/month/year of month/day/year. (9th of November anyone?)

There is a standard and I've forgotten the name of it, but it's

   YYYY-MM-DD HH:MM:SS

as a string - and what's good about that is you can sort it and compare it 
relatively easilly. (it's the datetime format that SQL uses)

> 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# .

What's the output technology? mISDN is the only one I've had issues with 
and that's mainly been on the input side. Never had an issue with anything 
else. (My least the punters haven't reported any problems - maybe they 
just don't call IVR systems!)

You might want to check the settings on the phones too - make sure you're 
using rfc2833, then it should stay out of band at least internally.

Gordon

>
> 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
>

-- 
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