Computer Science Canada Need Help - Read/Write for a file |
Author: | RedRogueXIII [ Sat Nov 05, 2005 1:23 pm ] | ||
Post subject: | Need Help - Read/Write for a file | ||
I need help on a porgram where it would would read a file, check for a certain character and then write everything but that character to a new file. This is what i have so far. ( I dont know how to get the whole file's data)
help would very much be appreciated. |
Author: | drumman4ever [ Sat Nov 05, 2005 5:11 pm ] | ||
Post subject: | |||
Well, when you get the line, you could put it to a temp variable, then check the temp if it is that character, if it isn't than write it out.
Hope that helped you out. |
Author: | Cervantes [ Sat Nov 05, 2005 6:32 pm ] | ||
Post subject: | |||
You don't get data character by character in Turing. You get it word by word or line by line. Also, don't be using a for loop to get data from the file, unless you're certain how much data is in the file. Instead, use loops and eof:
You'll have to use some string manipulation to determine if the character is in the string. Either for loop through the string, or use index(). Check out the String Manipulation and Index tutorials in the Turing Tutorial section. [edit] Oh wow. You are trying to put the sum of the integer values of your filenumber variables into your new file? No, those integer variables merely represent the file as an allocated object. They do not reflect the data inside the file. |
Author: | RedRogueXIII [ Sat Nov 05, 2005 10:16 pm ] |
Post subject: | |
honestly i just got frustrated.... its supposed to be transfering the first file's data while editing out all the spaces into a new file. |