| |

VerySource

 Forgot password?
 Register
Search
View: 777|Reply: 4

Why the written data is garbled

[Copy link]

2

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-2-14 18:30:01
| Show all posts |Read mode
Why the written data is garbled

CFile File;
File.Open (_T ("c:\\rxg.txt"), CStdioFile :: modeCreate | CStdioFile :: modeWrite, NULL);
CString str = _T ("name");
  for (int i = 0; i <10; i ++)
{
    File.Write (str, str.GetLength ());
    File.Write (_T (","), 1);
}
File.Write (_T ("\n"), 1);

The data written in this way is garbled? ? ?
Reply

Use magic Report

0

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-5-11 12:45:01
| Show all posts
Because of the use of UNICODE, modify it
CFile File;
File.Open (_T ("c:\\rxg.txt"), CStdioFile :: modeCreate | CStdioFile :: modeWrite, NULL);
CStringA str = "Name";
  for (int i = 0; i <GetHeaderCtrl ()-> GetItemCount (); i ++)
{
    File.Write (str, str.GetLength ());
    File.Write (",", 1);
}
File.Write ("\n", 1);
Reply

Use magic Report

2

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-5-21 20:15:01
| Show all posts
Niu Ren ..., too powerful .........
Thank you:)
Reply

Use magic Report

0

Threads

4

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-26 13:30:01
| Show all posts
Is it a character set problem?
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-26 15:45:01
| Show all posts
Before the file is used, specify the cache space for it. If the space is not enough, garbled characters may appear!
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list