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

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

Div. prog test - Reza 16/11/99

File size: 1.0 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
11int main(int narg, char* arg[])
12{
13SambaInitiator smbinit;
14
15if (narg < 2) {
16 cerr << " Usage: scanppf filename \n " << endl;
17 exit(0);
18 }
19
20try {
21 string flnm = arg[1];
22 PPersist* op = NULL;
23 cout << " Opening PPF file " << flnm << endl;
24 PInPersist s(flnm);
25 int nt = s.NbTags();
26 cout << " Number of tags in file = " << nt << endl;
27 if (nt < 1) {
28 op = s.ReadObject();
29 cout << " Object Type " << typeid(*op).name() << endl;
30 if (op) delete op;
31 }
32 else for(int i=0; i<nt; i++) {
33 cout << ">>> TagNum= " << i << " TagName= " << s.GetTagName(i) << endl;
34 s.GotoTagNum(i);
35 op = s.ReadObject();
36 cout << " Object Type " << typeid(*op).name() << endl;
37 if (op) delete op;
38 }
39}
40catch (PThrowable pex) {
41 cerr << " scanppf/Error - Exception catched " << pex.Msg() << endl;
42}
43
44cout << " ----------- End of scanppf ------------- " << endl;
45}
Note: See TracBrowser for help on using the repository browser.