]> SALOME platform Git repositories - modules/kernel.git/blob - src/HDFPersist/test8.cxx
Salome HOME
Initialisation de la base KERNEL avec la version operationnelle de KERNEL_SRC issue...
[modules/kernel.git] / src / HDFPersist / test8.cxx
1 using namespace std;
2 #include <iostream.h>
3 #include "HDFOI.hxx"
4 #include <stdlib.h>
5
6
7 int main()
8 {
9   HDFfile *hdf_file;
10   HDFgroup *hdf_group;
11   HDFdataset *hdf_dataset;
12   hdf_size size[1];
13   char message[HDF_NAME_MAX_LEN+1] = "MESSAGE";
14   hdf_int32 attribute = 3;
15
16   system("rm file_ascii.hdf");
17
18   try
19     {
20       // a new HDFfile object
21       hdf_file = new HDFfile("file_ascii.hdf");
22       MESSAGE( ">> A HDFfile object is created" );
23       
24       hdf_file->CreateOnDisk();
25       MESSAGE( ">> The HDF file is created on Disk " );
26
27       // Inside the HDF file 
28
29       // A new HDF group object
30       hdf_group = new HDFgroup("ASCII GROUP",hdf_file);
31       MESSAGE( ">> A HDFgroup object 'ASCII' is created" );
32
33       hdf_group->CreateOnDisk();
34       MESSAGE( ">> The HDF group is created on Disk " );
35
36       // Transfert d'un fichier ASCII dans un groupe HDF
37       HDFConvert::FromAscii("ascii.txt",*hdf_group,"ASCII DATASET");
38       MESSAGE( ">> The Ascii file is transfered " );
39  
40       // The HDF group is built, it can be closed
41       hdf_group->CloseOnDisk();
42       MESSAGE( ">> The HDF group is closed on Disk " );
43
44       // The HDF file is built, it can be closed
45       hdf_file->CloseOnDisk();
46       MESSAGE( ">> The HDF file is closed on disk" );
47
48  
49       delete hdf_group;
50       MESSAGE( ">> The HDF group object is deleted" ); 
51       delete hdf_file;
52       MESSAGE( ">> The HDF file object is deleted" );
53     }
54   catch (HDFexception)
55     {
56       MESSAGE( "!!!! HDFexception" )
57     }
58
59   return 0;
60 }