*** empty log message ***
[h316.git] / pc-tools / ldc2 / src / tool.cpp
CommitLineData
4741aa72 1/******************************************************************************
2 *
3 * LDC2 source code
4 *
5 * $Date: 2007/03/26 01:00:40 $
6 * $Author: hachti $
7 *
8 * $Log: tool.cpp,v $
9 * Revision 2.0 2007/03/26 01:00:40 hachti
10 * *** empty log message ***
11 *
12 *
13 ******************************************************************************/
14
ea4c19a4 15#include <vector>
16#include <string>
17
18#include <stdio.h>
19
20#include "config.hh"
21
22using namespace std;
23
ea4c19a4 24
25/*!
874a2bd8 26 *\brief Output a vector of strings.
ea4c19a4 27 *\arg strings A vector containing text.
874a2bd8 28 *\arg fp A FILE pointer where to write to.
ea4c19a4 29 *\retval 0 The vector was empty.
30 *\retval 1 The vector contained text.
31 */
874a2bd8 32int dump_vector_fp(vector<string> strings, FILE * fp){
ea4c19a4 33 int res=0;
34 for (vector<string>::iterator iter=strings.begin();iter<strings.end();iter++){
de6b6757 35 fprintf(fp,"%s\n",
36 iter->substr(0,iter->find_last_not_of(" ")+1).c_str());
ea4c19a4 37 res=1;
38 }
39 return res;
40}
874a2bd8 41
42/*!
de6b6757 43 *\brief Output a vector of strings to out_fd.
44 *\arg strings A vector containing text.
45 *\retval 0 The vector was empty.
46 *\retval 1 The vector contained text.
874a2bd8 47 */
de6b6757 48int dump_vector(vector<string> strings){
49 FILE * fp=fdopen(out_fd,"w");
50 return dump_vector_fp(strings,fp);
874a2bd8 51}