"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
If the string for which you want to remove a character from is a CString object, why would you not want to use the Remove() method?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
You need to:
(1) read the file.
(2) change the read content, removing CRLF occurrences.
(3) write again the content to the file.
You can use a brute force approach, i.e. reading a char at time and discarding unwantend ones (maybe you need to lookahead 1 char) and then rewriting all remaining characters. On the other hand, you can speed up the whole operation using buffers.
Hope that helps.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
I am using VS2005 Professional edition (procured by my company) on Windows XP Pro SP2 to develop a MFC application. Currently I am facing two problems and I am unable to determine the reason for the same. The application is packaged using Install shield which also include VC++2005 redistributable binaries and installs it on the target machine if these are not located. On my machine I have two versions of VC++ 2005 runtime binaries (one for VC++2005 and other for VC++2005 SP1). Now on to the problem description
1. When I execute release version of my application on my machine and perform Print operation via Print Preview dialog box, the application crash. The stack trace shows a crash in the MFC library mfc80u.dll (8.0.50727.762). However when I execute my application on a fresh machine and performs the same application it works fine. My query is why is the application using MFC libraries from VC++2005 SP1. I have not installed VC++2005 SP1 on my machine and not sure which application installed them. I tried copying MFC and C Runtime libraries from VC++ 2005 redistributables package along with the required manifest files to the application binary folder but still the application is using MFC libraries from SP1 and crashes at the same location. If I perform print operation directly using Print Menu item, the application works properly under all conditions. So I doubt if there is a bug in my application or is the application crashing due to the fact it is not complied with VC++ 2005 SP1 but trying to use MFC libraries from SP1. Though I doubt that it is most probably the formal case but I am not sure.
How do I ensure that I compile my application using the MFC and C runtime libraries from the original version and not from SP1? How do I uninstall VC++ 2005 SP1 MFC and C runtime libraries?
2. The same application also has mail sending capability which works fine on all versions of Windows except on Windows 2003 Server Enterprise edition with SP1. On Win2k3 Enterprise edition the application hangs when using mail functionality and I have to kill it using Task Manager. I doubt if it is something to do with WinSock libraries on Win2K3 but again I am not sure if it is due to a bug in my application.
Kindly provide me some pointers which can help me in resolving these issues.
I have not used 2008. I have not read anything about it that would lead me to believe they dropped suppport for creating native C++ applications. It is far more likely that you just have not figured out how to do it.
Welcome. Having been here six months I can highly recommend it as a place to learn a lot and help other a bit as well.
By the way please post chatty messages in the Lounge to avoid being flamed and programming questions anywhere but the Lounge to avoid being thoroughly barbecued
Nothing is exactly what it seems but everything with seems can be unpicked.
Please How I can delete element from the struct that contain arrays
This is My Code
struct Member<br />
char name;<br />
char address;<br />
int number;<br />
struct Member member;<br />
And i have this Function for delete elements But how i can complete it<br />
void delete_member ()<br />
int search;<br />
cout <<"Enter Your Number of member:";<br />
cin >> search;<br />
for (int i=0;i<100;i++)<br />
if (member[i].number == search)<br />
/* what can i write here to complete the code */<br />
To Be Or Not To Be
You can't remove elements in such an array. And even worse, your array will be initialized with garbage structures (except if you provide a default constructor to your structure).
I suggest you take a look at a std::list, this will do what you are looking for (but you'll probably need some time to learn how to use it, look for some tutorials).