Thread: Binary,Hexadecimal to Text

  1. #1

    Question Binary,Hexadecimal to Text


    I am pretty new to C++ and have been known to be a bit of an idiot...anyway.

    I am trying to write a simple dos based program to convert normal text to hex or binary and visa versa.

    Basically I want to be able to input text and convert it to hex/bin or input hex/bin and convert it to text.

    However I am at a loss of an short way to do this without typing out the ASCII character code chart..

    I was thinking i would need to store the values in an array but i haven't yet mastered this either.

    So I guess I am asking is there a simple way to do this ? I am not asking you to write the program for me just give me some direction as to how to do it....

    Thanks heaps.

    (sorry if this has been posted a billion times before I searched but didn't find what I wanted.)

  2. #2
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    yes... unregistered has been an idiot for more times than i can remember

    a string in c is simply an array of char followed by a 0
    PHP Code:
    #include <stdio.h> 
    #include <math.h>
    int main() {
    char *temp "the word";
    char x;
    while (
    x=*temp++) {
    for (
    int i=7;i>=0;i++)


    this prints the hex part then the decimal right after. take what you need from this

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A bunch of Linker Errors...
    By Junior89 in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2006, 02:59 PM
  2. struct question
    By caduardo21 in forum Windows Programming
    Replies: 5
    Last Post: 01-31-2005, 04:49 PM
  3. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  4. Ok, Structs, I need help I am not familiar with them
    By incognito in forum C++ Programming
    Replies: 7
    Last Post: 06-29-2002, 09:45 PM
  5. Outputting String arrays in windows
    By Xterria in forum Game Programming
    Replies: 11
    Last Post: 11-13-2001, 07:35 PM