Check if stdio supports tweaking lval and cnt simultaneously.
[p5sagit/p5-mst-13.2.git] / epoc / epocish.c
1 /*
2  *    Copyright (c) 1999 Olaf Flebbe o.flebbe@gmx.de
3  *    
4  *    You may distribute under the terms of either the GNU General Public
5  *    License or the Artistic License, as specified in the README file.
6  *
7  */
8
9 /* This is C++ Code !! */
10
11 #include <e32std.h>
12
13 extern "C" { 
14
15 epoc_spawn( char *cmd, char *cmdline) {
16   RProcess p;
17   TRequestStatus status;
18   TInt rc;
19
20   rc = p.Create( _L( cmd), _L( cmdline));
21   if (rc != KErrNone)
22     return -1;
23
24   p.Resume();
25   
26   p.Logon( status);
27   User::WaitForRequest( status);
28   if (status!=KErrNone) {
29     return -1;
30   }
31   return 0;
32 }
33
34
35   /* Workaround for defect atof(), see java defect list for epoc */
36   double epoc_atof( const char* str) {
37     TReal64 aRes;
38
39     TLex lex( _L( str));
40     TInt err = lex.Val( aRes, TChar( '.'));
41     return aRes;
42   }
43
44   void epoc_gcvt( double x, int digits, unsigned char *buf) {
45     TRealFormat trel;
46
47     trel.iPlaces = digits;
48     trel.iPoint = TChar( '.');
49
50     TPtr result( buf, 80);
51
52     result.Num( x, trel);
53     result.Append( TChar( 0));
54   }
55 }