[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-usability
Subject: Re: idea calculator - bc and national language?
From: Sébastien_Laoût "\[temporar\]" <les83plus () free ! fr>
Date: 2004-07-22 13:18:29
Message-ID: 1090502308.3469.21.camel () localhost ! localdomain
[Download RAW message or body]
Le mer 21/07/2004 à 09:42, Lubos Lunak a écrit :
> > What about replace all ',' by '.' before passing them to perl ?
> > Seem trivial and it would works.
>
> The code is in kdebase/kdesktop/minicli.cpp near the bottom, feel free to
> play with it. I'm not sure it'd be really that trivial.
QString Minicli::calculate(const QString &exp)
{
QString result;
QString cmd;
//<<
if( !KStandardDirs::findExe( "bc" ).isEmpty()) {
QString expWithPoints = exp.replace(",", ".");
cmd = QString("echo \"scale=20;%1\" | bc" ).arg(expWithPoints);
} else
//>>
cmd = QString("echo $((%1))").arg(exp);
FILE *fs = popen(QFile::encodeName(cmd).data(), "r");
if (fs)
{
QTextStream ts(fs, IO_ReadOnly);
result = ts.read().stripWhiteSpace();
pclose(fs);
}
return result;
}
No ?
A problem with that ?
I search... but I find it trivial.
But I'm not an expert hacker :-)
_______________________________________________
kde-usability mailing list
kde-usability@kde.org
https://mail.kde.org/mailman/listinfo/kde-usability
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic