Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
how i can delete some char in a file?i have a file and i want to remove some char from it and i want to swap some char to another and i should done it without using a temp string.in generally how to change in content 's file?
Posted
Comments
Code-o-mat 30-May-14 5:51am    
What do you mean by "without using a temp string"? Give an example possibly...

See below example and made changes in that as per your requirement:-
this is just idea how you can do that
C++
#include<iostream>
#include<cstdio>
#include<fstream>
#include<string>

int main ()
{
    ifstream file("vowels.txt");

    char cstr[80];
    
    while (!file.eof())
    {

    file.getline(cstr,80);
    
    
    
    for(int i = 0; i < cstr.length(); i++)
    {
            if(cstr[i] == 'a' || cstr[i] == 'e' || cstr[i] == 'i' || cstr[i] == 'o' || cstr[i] ='u') 
            {
            cstr[i] = '';
            }
            else
	    {
              text[i]= putchar(toUpper(text[i]));
            }
    
    }


}

system("pause");
return 0;
}
 
Share this answer
 
v3
Please describe what type of characters you want to remove?
I have created an application in VB.Net for specific and private use.
but, if you can describe your question then only members can help you. :)
 
Share this answer
 
Comments
mary99 30-May-14 3:43am    
i want to convert Lowercase to Capital letters and remove Vowels from file.for example if we have in file" abcdefo" we should change it to "BCDF". my question is how to remove these char i mean what function i use?
Tejas Dhamankar 30-May-14 4:15am    
this is your custom need right?
so you have to create custom code for that...
a basic step is that you can run a for loop for that
for ex.
Dim iString as new TextBox 'create a vitual textstore
For Each iChar in TextBox.Text 'check each char from input
If char.isLower(iChar) Then iString.AppendText(char.toUpper(iChar)) ' checks if char is lower if yes converts to upper
Next

and for replacement just use txtInputTextBox.Replace method
or check this link "http://www.vbforums.com/showthread.php?713587-Removing-vowels-from-string"

I am not coding with any editor right now so the above code may have bugs.
its just an Idea, to how you should process.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900