diff options
author | Kyle K <kylek389@gmail.com> | 2011-02-18 21:24:31 -0600 |
---|---|---|
committer | Kamil Kaminski <kamilkss@gmail.com> | 2011-02-18 21:24:31 -0600 |
commit | 6f39a3ebc807f66a32201ad24794ed7881151217 (patch) | |
tree | c9a1fc6b77cf071c9e86eb7e6055567f14c7ed10 /toCBC.cpp | |
parent | 4875a6cf6a7f01c775df6ff70f7dd1116429d8f4 (diff) | |
download | rsacrypt-6f39a3ebc807f66a32201ad24794ed7881151217.tar.gz rsacrypt-6f39a3ebc807f66a32201ad24794ed7881151217.tar.bz2 rsacrypt-6f39a3ebc807f66a32201ad24794ed7881151217.zip |
add few files
Diffstat (limited to 'toCBC.cpp')
-rw-r--r-- | toCBC.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/toCBC.cpp b/toCBC.cpp new file mode 100644 index 0000000..f8af0fb --- /dev/null +++ b/toCBC.cpp @@ -0,0 +1,54 @@ +// This program will take an ASCII text file +// and covert the file to a "character-by-character" +// file which will contain the decimal value from +// each ASCII character. + +#include <fstream> +#include <iostream> +#include <cstdlib> + +using namespace std; + +int main (int argc, char *argv[]) +{ + ifstream infile; + ofstream outfile; + + char bit; + int charValue; + int i; + + //for (i = 0; i < argc; i++) + //cout << i << ": " << argv[i] << endl; + + if (argc < 2) + { + cout << "Usage: " << argv[0] << " inputFileName [ outputFileName ]" << endl; + exit(1); + } + + cout << argv[0] << ": opening file " << argv[1] << endl; + infile.open (argv[1]); + + if ( argc < 3 ) + { + outfile.open ("outfile.cbc"); + } + else + outfile.open (argv[2]); + + i = 0; + while (!infile.eof()) + { + charValue = infile.get(); + if (infile.good()) + outfile << charValue << endl; + i++; + } + + infile.close(); + outfile.close(); + + return 0; +} + |