![]() |
|
#1
|
|||
|
|||
My programs output is a string of smiley facesI am obviously a beginning programmer. I have a C program that takes input that is redirected from a file, strips out all vowels, and prints the rest to the screen. When I run it, it prints out a long string of smiley faces instead of the text. The redirected file is a simple text file created with notepad that contains some text.
Any suggestions? |
|
#2
|
||||
|
||||
|
Quote:
1) Make sure you aren't outputting a string using "%c" in the printf() statement. Conversely make sure you aren't trying to output a character with "%s". 2) Be sure you aren't trying to output characters beyond the limit of your string Also, post code sections here. Many of us won't download files -- we have enough stuff on our harddrives... __________________
Age is unimportant -- except in cheese |
|
#3
|
|||
|
|||
|
I didn't paste the source inline in my message because the forum doesn't display some of it correctly. I just read the post on how to enclose source code. Here it is:
CPP / C++ / C Code:
|
|
#4
|
|||
|
|||
|
Quote:
Try printing out the characters in hex. Maybe you can figure how the values are equal to 0x01. Hint: precedence of = and != That is, instead of this: CPP / C++ / C Code:
Try this: CPP / C++ / C Code:
Regards, Dave |
|
#5
|
|||
|
|||
|
I changed my code as you suggested, and here is the output:
☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 0 1 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: 01 ☺: I still don't understand what is going wrong. Thank you for your your help. Scramble |
|
#6
|
|||
|
|||
|
I figured it out!
I changed this: CPP / C++ / C Code:
CPP / C++ / C Code:
Thanks, Scramble |
|
#7
|
|||
|
|||
|
yeah the compiler is laughing at you. Don't be discouraged, it does that to all the beginners
Quote:
__________________
spasms!!! |
Recent GIDBlog
Flickr uploads of IA pictures by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Read a .html file, check that file for links | salemite | C Programming Language | 10 | 17-Jan-2008 07:56 |
| Re: Conversion: Binary, Decimal, Hexadecimal | WaltP | C Programming Language | 1 | 10-May-2006 06:49 |
| No output from loop function | crystalattice | C++ Forum | 2 | 20-Dec-2004 20:39 |
| using vector or array | oshiotse | C++ Forum | 4 | 16-Apr-2004 10:59 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The