![]() |
|
#1
|
|||
|
|||
Batch replace textI have problem with batch replacing a text file
example: a file name :"first .txt" has the following text A 1 B 2 C 3 another file "second .txt" has the following text "r if this is your first time here, and if you wish to include example C++ code in your posts and messages, please surround your example codes" task is where ever "a" is there it should repalce with 1 and "b" is there should replace with 2 can any body help in this |
|
#2
|
|||
|
|||
Re: batch replace textYes we could 'help'. Instead starting off by working with the two files,
why not just declare the replacement 'source' characters: char A, B, C; A = '1'; B = '2'; C = '3'; Then fopen() the file for reading and writing, read along char by char, replace the target characters with source characters, fclose() the file, exit. Then add the 'working with a source file'. Where in this process do you have trouble? We start there! Post the code if you have any started. That helps us to see your thinking on this. Try searching the forum for previous examples. Keywords might be 'reading file' or 'fopen' etc. Howard; |
|
#3
|
|||
|
|||
Re: batch replace textQuote:
Do you want to assume that 'A' and 'a' both are to be replaced with a '1'? If so, do you expect that the input file for the substitution list is complete and includes all of the letters in the (Roman/Latin1) alphabet? Are we supposed to only replace those characters that are found in the substitution list? Can we assume that a maximum of 26 characters are going to be substituted or shall we expect 52 (lowercase and uppercase) or 36/62 (includes 0-9)? :davis: |
Recent GIDBlog
Developing GUIs with wxPython (Part 3) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to read unknown total of int data from text file to a 2-dim array in C or C++? | ladyscarlet99 | C Programming Language | 2 | 09-Sep-2005 14:07 |
| 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