Click here to Skip to main content
15,890,123 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Need to end a string with null instead of \r\n Pin
Waldermort27-Aug-06 12:00
Waldermort27-Aug-06 12:00 
GeneralRe: Need to end a string with null instead of \r\n Pin
samkook27-Aug-06 12:19
samkook27-Aug-06 12:19 
GeneralRe: Need to end a string with null instead of \r\n Pin
fefe.wyx27-Aug-06 14:42
fefe.wyx27-Aug-06 14:42 
GeneralRe: Need to end a string with null instead of \r\n Pin
David Crow28-Aug-06 4:11
David Crow28-Aug-06 4:11 
GeneralRe: Need to end a string with null instead of \r\n Pin
David Crow28-Aug-06 4:14
David Crow28-Aug-06 4:14 
AnswerRe: Need to end a string with null instead of \r\n Pin
kakan27-Aug-06 22:51
professionalkakan27-Aug-06 22:51 
GeneralRe: Need to end a string with null instead of \r\n Pin
samkook28-Aug-06 7:02
samkook28-Aug-06 7:02 
GeneralRe: Need to end a string with null instead of \r\n Pin
kakan28-Aug-06 19:31
professionalkakan28-Aug-06 19:31 
Hello.

I just debugged the code I gave you and it works as it should.
It removes any CR LF combinations from the end of the string.

The result is stored in str (assuming you do not delete the string before writing it to the file!).

My code will replace all terminating CR and LF with nulls in the buffer, that's right. But when you later uses the resulting buffer, it's the first null char that counts. Simply because a null char is seen as a string terminator.

If you want the length of the resulting string, just use strlen() (or it's variants).

PS.
English isn't my native lingo either.


Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson

QuestionScreen Sizes Pin
BlitzPackage27-Aug-06 9:58
BlitzPackage27-Aug-06 9:58 
AnswerRe: Screen Sizes Pin
Waldermort27-Aug-06 10:58
Waldermort27-Aug-06 10:58 
GeneralRe: Screen Sizes Pin
BlitzPackage27-Aug-06 15:35
BlitzPackage27-Aug-06 15:35 
AnswerRe: Screen Sizes Pin
Hamid_RT27-Aug-06 21:08
Hamid_RT27-Aug-06 21:08 
GeneralRe: Screen Sizes Pin
BlitzPackage28-Aug-06 2:49
BlitzPackage28-Aug-06 2:49 
GeneralRe: Screen Sizes Pin
Hamid_RT28-Aug-06 4:20
Hamid_RT28-Aug-06 4:20 
Questionwclen returning wrong value Pin
Waldermort27-Aug-06 8:37
Waldermort27-Aug-06 8:37 
AnswerRe: wclen returning wrong value Pin
Nibu babu thomas27-Aug-06 17:25
Nibu babu thomas27-Aug-06 17:25 
GeneralRe: wclen returning wrong value Pin
Waldermort27-Aug-06 20:13
Waldermort27-Aug-06 20:13 
QuestionAdding Components and control in VC2005 Pin
pimpim323227-Aug-06 8:08
pimpim323227-Aug-06 8:08 
AnswerRe: Adding Components and control in VC2005 Pin
pimpim323227-Aug-06 8:42
pimpim323227-Aug-06 8:42 
GeneralRe: Adding Components and control in VC2005 Pin
Wes Aday27-Aug-06 15:12
professionalWes Aday27-Aug-06 15:12 
Questionsearching in strings [modified] Pin
jon-8027-Aug-06 6:44
professionaljon-8027-Aug-06 6:44 
AnswerRe: searching in strings Pin
Kevin McFarlane27-Aug-06 6:55
Kevin McFarlane27-Aug-06 6:55 
AnswerRe: searching in strings Pin
Waldermort27-Aug-06 7:57
Waldermort27-Aug-06 7:57 
AnswerRe: searching in strings Pin
BlitzPackage27-Aug-06 15:40
BlitzPackage27-Aug-06 15:40 
GeneralRe: searching in strings Pin
Stephen Hewitt27-Aug-06 18:30
Stephen Hewitt27-Aug-06 18:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.