| 
            Last change
 on this file since 630 was             589, checked in by ansari, 26 years ago           | 
        
        
          | 
             
ajoute possibilite lecture sequentielle meme si tags 
 
           | 
        
        
          | 
            File size:
            1.2 KB
           | 
        
      
      
| Rev | Line |   | 
|---|
| [583] | 1 | #include <stdio.h>
 | 
|---|
 | 2 | #include <stdlib.h>
 | 
|---|
 | 3 | #include <typeinfo>
 | 
|---|
 | 4 | #include <iostream.h>
 | 
|---|
 | 5 | #include <string>
 | 
|---|
 | 6 | 
 | 
|---|
 | 7 | #include "ppersist.h"
 | 
|---|
 | 8 | #include "anydataobj.h"
 | 
|---|
 | 9 | #include "sambainit.h"
 | 
|---|
 | 10 | 
 | 
|---|
 | 11 | int main(int narg, char* arg[])
 | 
|---|
 | 12 | {
 | 
|---|
 | 13 | SambaInitiator smbinit;
 | 
|---|
 | 14 | 
 | 
|---|
 | 15 | if (narg < 2) {
 | 
|---|
| [589] | 16 |   cerr << " Usage: scanppf filename [s]\n " <<  endl;
 | 
|---|
| [583] | 17 |   exit(0);
 | 
|---|
 | 18 |   }
 | 
|---|
 | 19 | 
 | 
|---|
 | 20 | try {
 | 
|---|
 | 21 |   string flnm = arg[1];
 | 
|---|
| [589] | 22 |   bool seq=false;
 | 
|---|
 | 23 |   if (narg > 2) seq=true;
 | 
|---|
| [583] | 24 |   PPersist* op = NULL;
 | 
|---|
 | 25 |   cout << " Opening PPF file " << flnm << endl; 
 | 
|---|
 | 26 |   PInPersist s(flnm);
 | 
|---|
 | 27 |   int nt = s.NbTags();
 | 
|---|
 | 28 |   cout << " Number of tags in file = " << nt << endl;
 | 
|---|
 | 29 |   if (nt < 1) { 
 | 
|---|
 | 30 |     op = s.ReadObject();
 | 
|---|
 | 31 |     cout << " Object Type " << typeid(*op).name() << endl;
 | 
|---|
 | 32 |     if (op) delete op;
 | 
|---|
 | 33 |   }
 | 
|---|
| [589] | 34 |   else if (!seq) {
 | 
|---|
 | 35 |     for(int i=0; i<nt; i++) {
 | 
|---|
 | 36 |       cout << ">>> TagNum= " << i << " TagName= " << s.GetTagName(i) << endl;
 | 
|---|
 | 37 |       s.GotoTagNum(i);
 | 
|---|
 | 38 |       op = s.ReadObject();
 | 
|---|
 | 39 |       cout << " Object Type " << typeid(*op).name() << endl;
 | 
|---|
 | 40 |       if (op) delete op;
 | 
|---|
 | 41 |     }
 | 
|---|
 | 42 |   } else {
 | 
|---|
 | 43 |     while (1) {
 | 
|---|
 | 44 |       op = s.ReadObject();
 | 
|---|
 | 45 |       cout << " Object Type " << typeid(*op).name() << endl;
 | 
|---|
 | 46 |       if (op) delete op;
 | 
|---|
 | 47 |     }
 | 
|---|
| [583] | 48 |   }
 | 
|---|
 | 49 | }
 | 
|---|
 | 50 | catch (PThrowable pex) {
 | 
|---|
 | 51 |   cerr << " scanppf/Error - Exception catched " << pex.Msg() << endl;
 | 
|---|
 | 52 | }
 | 
|---|
 | 53 | 
 | 
|---|
 | 54 | cout << " ----------- End of scanppf ------------- " << endl;
 | 
|---|
 | 55 | }
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.