cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Replacing tabs with spaces in txt file
Replacing tabs with spaces in txt file
Jan 24, 2011 at 8:47pm UTC
erry121
(6)
What commands i have to use to replace tabs with white spaces reading an input txt file?
Thank's to all!
Jan 24, 2011 at 9:01pm UTC
PanGalactic
(1658)
Please read this:
http://www.cplusplus.com/forum/beginner/1/#msg6680
Jan 24, 2011 at 9:12pm UTC
erry121
(6)
My example of txt input file is this:
9 10.1.1.9 10.1.1.1 5,003375 00:00:00:00:09 00:00:00:00:08 3
The code that i try but doesn't work is:
1
2
size_t pos = buffer.find(
'\0009'
); buffer.replace(pos,1,
" "
);
The \u0009 is the Unicode Character 'CHARACTER TABULATION' for c++, is right?
Jan 24, 2011 at 9:54pm UTC
PanGalactic
(1658)
'\t' is the tab character. '\0009' is a multi-character constant (NUL, 9). The first four characters '\000' are interpreted as an octal sequence (0 or the NUL character). The '9' is interpreted as stand-alone character.
Last edited on
Jan 24, 2011 at 9:55pm UTC
Topic archived. No new replies allowed.