Opening files in Hex mode to compress file size

I have an idea which i will try to implement in C++,I want to compress file size through making my own numbering system which is 80-based number, I do really want to know whether this even possible ? I learnet that Hexadecimal uses symbols like A, B, C, D, E, F to represent 10,11,12,13,14,15 -- and that's what i want to do to my own numbering system but in a bigger scale . Please correct me if i'm missing something .

if possible:
How can i use C++ to open a file in Hex mode ?
You can use e.g. the non standard itoa:

http://www.cplusplus.com/reference/cstdlib/itoa/

to achieve the base 80

A common encoding is Base64:

http://en.wikipedia.org/wiki/Base64


How can i use C++ to open a file in Hex mode ?
You can use a stream:

http://www.cplusplus.com/reference/fstream/fstream/

It has operators to read/write hex.

Or you use the C equivalent (s)printf/(s)scanf:

http://www.cplusplus.com/reference/cstdio/sprintf/?kw=sprintf
http://www.cplusplus.com/reference/cstdio/sscanf/?kw=sscanf
Thank you very much . your reply will help alot .
Making a new numbering system won't compress anything. Ultimately, the file is stored in binary (ie, just a string of 0s and 1s). So any data has to be represented in that form.

Hexadecimal is commonly used because the transition between binary<->hexadecimal is very simple and easy. 1 hex digit = 4 binary digits:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
hex = bin
_________
0x0 = 0000
0x1 = 0001
0x2 = 0010
0x3 = 0011
0x4 = 0100
0x5 = 0101
0x6 = 0110
0x7 = 0111
0x8 = 1000
0x9 = 1001
0xA = 1010
0xB = 1011
0xC = 1100
0xD = 1101
0xE = 1110
0xF = 1111



So the numbering system has nothing to do with how "compressed" the data is. It all takes the same amount of space.

Numbers are numbers. The only difference a different numerical base makes is how that number is represented through text.
I mean what if i could find some patterns and represent them in sympols ?
Finding repeating patterns is a common compression technique. That could work.

Though "represent them in symbols" doesn't really make sense. Remember... all a file is is a big series of numbers. And all it can be is a series of numbers.

Compression techniques work by taking a large series of numbers and finding a way to express it with a smaller series of numbers.
You unknowingly just came up with the primary technique used in all compression algorithms in use today. You'd be better off using an existing, 10mb text files into 20kb kind of thing.
Topic archived. No new replies allowed.