source: subversion/applications/lib/libimg/ImgSubfile.cpp @ 34650

Last change on this file since 34650 was 2092, checked in by enxrah, 13 years ago

Nick didn't write this. I did :-)

File size: 1.8 KB
Line 
1/*
2    Copyright (C) 2007 Robert Hart, rob@bathterror.free-online.co.uk
3
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 2 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU Lesser General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program; if not, write to the Free Software
16    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
17
18 */
19#include "Img.h"
20
21ImgSubfile::ImgSubfile(){
22  subtype = "???";
23}
24
25void ImgSubfile::CreateHeader(){
26  cout << "ImgSubfile::CreateHeader() called\n";
27}
28
29int ImgSubfile::ReadFile(std::ifstream &in){
30  int headerlen, locked;
31  std::string typedesc("");
32
33  if(data) delete data;
34  nblocks = Fat.GetNumBlocks();
35  data = new char[nblocks * blocksize];
36  in.read(data, nblocks * blocksize);
37  cout << "reading " << nblocks << " blocks (" << nblocks * blocksize << " bytes)\n";
38  headerlen = DecodeShort(0x0);
39  DecodeString(0x2, 10, typedesc);
40  locked = DecodeByte(0xD);
41  updatetime.tm_year= DecodeShort(0xE)-1900;
42  updatetime.tm_mon = DecodeByte(0x10);
43  updatetime.tm_mday= DecodeByte(0x11);
44  updatetime.tm_hour= DecodeByte(0x12);
45  updatetime.tm_min = DecodeByte(0x13);
46  updatetime.tm_sec = DecodeByte(0x14);
47  cout << "Reading file of type : " << typedesc << endl;
48  cout << "update time :" << asctime(&updatetime) << endl;
49  cout << "headerlen :" << headerlen << endl;
50  cout << "locked :" << locked << endl;
51  return headerlen;
52}
53
Note: See TracBrowser for help on using the repository browser.