source: Sophya/trunk/SophyaProg/Tests/scanppf.cc@ 742

Last change on this file since 742 was 742, checked in by ansari, 26 years ago

new md5

File size: 1.3 KB
Line 
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#ifdef __MWERKS__
12#include <console.h>
13#endif
14
15int main(int narg, char* arg[])
16{
17
18#ifdef __MWERKS__
19narg = ccommand(&arg);
20#endif
21
22SambaInitiator smbinit;
23
24if (narg < 2) {
25 cerr << " Usage: scanppf filename [s]\n " << endl;
26 exit(0);
27 }
28
29try {
30 string flnm = arg[1];
31 bool seq=false;
32 if (narg > 2) seq=true;
33 PPersist* op = NULL;
34 cout << " Opening PPF file " << flnm << endl;
35 PInPersist s(flnm);
36 int nt = s.NbTags();
37 cout << " Number of tags in file = " << nt << endl;
38 if (nt < 1) {
39 op = s.ReadObject();
40 cout << " Object Type " << typeid(*op).name() << endl;
41 if (op) delete op;
42 }
43 else if (!seq) {
44 for(int i=0; i<nt; i++) {
45 cout << ">>> TagNum= " << i << " TagName= " << s.GetTagName(i) << endl;
46 s.GotoTagNum(i);
47 op = s.ReadObject();
48 cout << " Object Type " << typeid(*op).name() << endl;
49 if (op) delete op;
50 }
51 } else {
52 while (1) {
53 op = s.ReadObject();
54 cout << " Object Type " << typeid(*op).name() << endl;
55 if (op) delete op;
56 }
57 }
58}
59catch (PThrowable pex) {
60 cerr << " scanppf/Error - Exception catched " << pex.Msg() << endl;
61}
62
63cout << " ----------- End of scanppf ------------- " << endl;
64}
Note: See TracBrowser for help on using the repository browser.