File: fprintf.cc

package info (click to toggle)
icmake 13.05.01-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,132 kB
  • sloc: cpp: 11,595; fortran: 883; makefile: 853; sh: 546; pascal: 342
file content (20 lines) | stat: -rw-r--r-- 586 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//#define XERR
#include "builtin.ih"

// prints the arguments of an fprintf call.
// 
// The arguments are: the number of arguments ([2]), a filename ([3]), and
// then the remaining arguments in the order in which they must be printed 
// ([4], [5], ...) 

void Builtin::fprintf()
{
    d_reg = d_stack[2];

    ofstream out = Exception::factory<ofstream>( 
                                    d_stack[3].str(), 
                                    ios::in | ios::ate, ios::out);

                                    // first arg = [2] (#args)
    insert(out, 4, 3 + d_reg.value());
}