Hi:everybody
When my program read a text file, I will copy each character one by one, when meet Tab key(equal 9), it is copied, by when shows on my
window,just like this: |, so the text format chage quite a
lot.
I am just wandering how can I deal with this.
Thanks a lot.
James
Comments
:
: When my program read a text file, I will copy each character one by one, when meet Tab key(equal 9), it is copied, by when shows on my
: window,just like this: |, so the text format chage quite a
: lot.
:
: I am just wandering how can I deal with this.
:
: Thanks a lot.
:
: James
:
:
Uh, if you're reading a text file in text format, a TAB reads in as ' '. Show me the line of code (or function body) that reads in your characters and I'll see if I can locate the error. Just post it here if you want.
-[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]
: :
: : When my program read a text file, I will copy each character one by one, when meet Tab key(equal 9), it is copied, by when shows on my
: : window,just like this: |, so the text format chage quite a
: : lot.
: :
: : I am just wandering how can I deal with this.
: :
: : Thanks a lot.
: :
: : James
: :
: :
: Uh, if you're reading a text file in text format, a TAB reads in as ' '. Show me the line of code (or function body) that reads in your characters and I'll see if I can locate the error. Just post it here if you want.
:
: -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]
:
:
[blue]What are you using to display the text?[/blue]
Thank you all for your emails.
Lets assume in my Notepad the text file only has this:
hello! world.
but before each word has two tab key.
--------------------code start--------------------------------
ReadFile(hFile, cMyBuffer, MAXSIZE, &dwNumRead, NULL);
for(int i = 0; i < dwNumRead; i++)
cString[i] = cMyBuffer[i]; //cMyBuffer[i] equals 9 if it is a Tab key.
TextOut (hdc, 0, 0, cString, lstrlen(cString));//will show: ||hello!||world
-------------------code end-------------------------------------
above code is a little bit modified, but I just let you know where is the 9 comes from, and why the | shows.
Any idea or suggestion will be appreciated!
James
From there go: [b]Font and Text[/b]
And then function: [b]DrawText()[/b]
Use flag: [b]DT_EXPANDTABS[/b][/blue]