Login Register


[NEED HELP] Text to binary code converter [Simple] filter_list
Author
Message
[NEED HELP] Text to binary code converter [Simple] #1
Code:
#include <string> #include <bitset> #include <iostream> #include <cstdlib> #include <string> #include <Windows.h> using namespace std; int main() { string convert; cout << "What to convert?: "; cin >> convert; string myString = convert; for (std::size_t i = 0; i < myString.size(); ++i) { cout << bitset<8>(myString.c_str()[i]) << endl; } Sleep(10000); }
And i may have included non-required stuff because i was working on an system that auto copy pastes the binary code to clipboard but i could not get it working (would appreciate if someone would help me with that)

Reply

RE: Text to binary code converter [Simple] #2
Hey im trying to save the binary code result to a text file and it only prints the words first letter as binary code
Code:
#include <string> #include <bitset> #include <iostream> #include <fstream> #include <cstdlib> #include <string> #include <Windows.h> using namespace std; int main() { string convert; cout << "What to convert?: "; cin >> convert; string myString = convert; for (std::size_t i = 0; i < myString.size(); ++i) { ofstream myfile; myfile.open ("test.txt"); myfile << bitset<8>(myString.c_str()[i]); myfile.close(); return(1); } }


[Image: TV2OhSG.png]

Reply

RE: Text to binary code converter [Simple] #3
(03-23-2013, 03:04 PM)Atex Wrote: Hey im trying to save the binary code result to a text file and it only prints the words first letter as binary code
Code:
#include <string> #include <bitset> #include <iostream> #include <fstream> #include <cstdlib> #include <string> #include <Windows.h> using namespace std; int main() { string convert; cout << "What to convert?: "; cin >> convert; string myString = convert; for (std::size_t i = 0; i < myString.size(); ++i) { ofstream myfile; myfile.open ("test.txt"); myfile << bitset<8>(myString.c_str()[i]); myfile.close(); return(1); } }

Use a openfiledialog to open the file, and a savefiledialog to edit/add to the textfile.

Reply

RE: [NEED HELP] Text to binary code converter [Simple] #4
I'm going to PM you about it, hopefully you can get this done.. binary is pretty fun to mess around with too.

Reply







Users browsing this thread: