![]() |
|
#1
|
|||
|
|||
Text erase?Iam writing a program that takes numbers and saves them to a text file (numbers.txt) than i would like it to take the numbers from numbers.txt and erase any odd numbers and save it to evenNumbers.txt, so in the end i would have two files, so far i am able to create and save the numbers in numbers.txt but iam not sure how to erase the odd numbers, any help would be much appreciated
CPP / C++ / C Code:
thanks in advance -boomstick |
|
#2
|
|||
|
|||
Re: text erase?Well, if you know how to save all the numbers, all you need to do is read the numbers and only write the odd numbers to the new file. No need to delete anything.
__________________
Music, programming, endless learning.. |
|
#3
|
|||
|
|||
Re: text erase?For deleting the content, you can use '\b' or ascii value of "backspace" key stroke.. That would replace the number(Character i.e 13 will become 1) with backspace character.....
Hope you understood what to do. If you are still unable then, I will give you the code. But I recommend you do it by yourself. |
|
#4
|
|||
|
|||
Re: text erase?iam not sure what iam missing than, iam sure its something real simple, ive been messing around with a few different things but still am getting no where
|
|
#5
|
|||
|
|||
Re: text erase?Why don't you post your code again and we'll take a look.
|
|
#6
|
|||
|
|||
Re: text erase?Quote:
|
|
#7
|
|||
|
|||
Re: text erase?I think you should write a function that reads from one stream and writes to another.
CPP / C++ / C Code:
|
|
#8
|
|||
|
|||
Re: text erase?Quote:
Well I was wanting to have it so it would create the numbers.txt than take the info from that and filter out the evens, I suppose thats kinda like what you are saying isn't it? |
|
#9
|
|||
|
|||
Re: text erase?I thought you already got file creation part working??? The sample I posted is for taking the file that already has numbers in it and creating a new file with all of those numbers except for the odds.
|
|
#10
|
||||
|
||||
Re: text erase?Quote:
The first one is simple. Based on the code you posted, read a number from the keyboard and write it to the file. Your first problem is that when reading numbers you cannot accept a letter to exit. You'll need some other way to exit the program. Second program: read the first file and output only the even numbers to the new file. Do you know how to test if a number is odd or even? __________________
Cow: You're a lawyer too? Mooseblood (mosquito): Ma'am, I was already a bloodsucking parasite. All I needed was a briefcase! |
Recent GIDBlog
2nd Week of IA Training by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| burning problems PLEASE PLEASE HELP | kelticeire | Computer Hardware Forum | 4 | 01-Dec-2006 15:39 |
| need help on text file analyser | ffantasy | C Programming Language | 1 | 05-Sep-2005 13:44 |
| saving html text | dopee | MySQL / PHP Forum | 1 | 17-Jan-2005 04:15 |
| CD burner wont burn!! | robertli55 | Computer Hardware Forum | 1 | 18-Jun-2004 10:53 |
| Yet another CD burner problem: Lite-On LSC-24082K | Erwin | Computer Hardware Forum | 1 | 22-May-2004 11:28 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The