finding space in text file
-
Hai ,can any body solve my problem?how can we find out the space character in a text file using vc++ ? An d also i want to replace that space to string .pls help me... shan
well.....it doent matter if u r using c/c++/vc++.....the method is the same... use the basic file operationz..... like fopen to open the file,fgetc()to get the character! eg: int a; ..... .... ... .. . a=fgetc(stream); ..... .... ... .. . and then if the value of a is 32(ascii) understand that it is space or if(fgetc(stream)==' ') by the way what do u mean by convert space to string????? "faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
-
Hai ,can any body solve my problem?how can we find out the space character in a text file using vc++ ? An d also i want to replace that space to string .pls help me... shan
If your file is not so big, and if your project is link to MFC as shared lib, you can use the class CString to handle the text file. e.g. CString tmp(buffer); // where buffer contains data read from your file CString replaceString("myreplacestring"); while(tmp.Replace(" ",replaceString)); // Not all string like " " will be replace by "myreplacestring" and not " " THink this helps you