Where is my code getting a smiley face from?

Well the program I'm writing is simple, and it's more of a hobby project, but anyways, my program is for some reason getting a smiley face and puting it in the output to a file that its writing to instead of putting the single digit number, but I can't figure out why for the life of me, can anyone tell me why it's doing this and how to fix it? By the way, I'm using put() to put the value I want into the file (or that I'm attempting to put), but instead of a "1" it puts "".
Last edited on
sorry it wont show the smiley that it keeps showing in the output

EDIT: Also, if wanted I could paste the source to my program on here... if it would help, I didn't post in first place cause it's a little messy cause when I debug, I tend to add very simple lines of code to tell me values of variables when something like this happens, that and the code pertaining to all this is kinda spread out throughout the source so that it does what it needs to...
Last edited on
nevermind, I figured out I was using get() wrong...

EDIT: and that the smiley face apparently is what you get for an ASCII code of "1"...
Last edited on
1
2
3
4
5
6
7
8
9
#include <iostream>

int main()
{
    std::cout << (char)1 << std::endl; //prints a smiley face with my environment
    std::cout << '1' << std::endl; //prints a 1

    return 0;
}


Some code that you think is causing the issue would be great. Remember to use [code][/code] tags.

Though it seems like you're printing a char with the ASCII value 1 as opposed to a char that is a 1.

EDIT: Oh, problem solved
Last edited on
ya, I was using an integer but when I was retrieving the value, I was using get() wrong, so it was coming back as 0 instead of 1 like I wanted, when I had a string print out what I thought It was doing it printed the one as a character, and that character happened to be a smiley, which was the exact opposite of how I felt...
which was the exact opposite of how I felt

Perhaps this character would've described your situation better?

1
2
3
4
5
6
7
8
#include <iostream>

int main()
{
    std::cout << '\a' << std::endl;

    return 0;
}
Perhaps this character would've described your situation better?

1
2
3
4
5
6
7
8
#include <iostream>

int main()
{
    std::cout << '\a' << std::endl;

    return 0;
}


maybe, when I compile that though, it doesn't display any characters, none that I see anyways...
what should I see?
Well, it's system dependent. On my computer it makes a BEEP sound.
Last edited on
oh, lol ya that probably would describe how I felt a little better.
Topic archived. No new replies allowed.