Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 128379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:37:34+00:00 2026-05-11T05:37:34+00:00

I read a file that has utf8 characters like this: FILE *FileIN,*FileOUT; FileIN=fopen(filename,r); char

  • 0

I read a file that has utf8 characters like this:

FILE *FileIN,*FileOUT; FileIN=fopen('filename','r'); char string[600]; WideChar C[600],S[100]; fgets(string,600,FileIN); wcscpy(C,UTF8Decode(string).c_bstr()); // widechar copy 

And it reads it perfectly (this is shown in the Editbox when running the program):

Edit1->Text=C;  Result ===> '3021';'亜';'7';'ア アシア つ.ぐ T1 や つぎ つぐ' 

The thing is that when I want to write this on a file:

FileOUT=fopen('txt.txt','w');     fwrite(Edit8->Text.c_str(),strlen(Edit8->Text.c_str()),1,FileOUT);  Result ===> '3021';'?';'7';'? ??? ?.? T1 ? ?? ??' 

The question is, how do I write the result (the one i can see in the program running) in a file?

I use C language on CodeGear C++Builder

Resolved thanks to Christoph and nobugz for the help

I changed this line

fwrite(Edit8->Text.c_str(),strlen(Edit8->Text.c_str()),1,FileOUT); 

to this one and it worked. Thanks

fwrite(UTF8Encode(Edit8->Text).c_str(),UTF8Encode(Edit8->Text).Length(),1,FileOUT); 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T05:37:34+00:00Added an answer on May 11, 2026 at 5:37 am

    I don’t know the framework, but if you use UTF8Decode() after reading the file, shouldn’t you use UTF8Encode() before writing?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a string to a file that has characters like Ԉ and
I am trying to read strings from a file that has each string on
Is it possible to read the content of a file that has been selected
I am trying to read and sort a csv file that has data that
I'm trying to read a csv file into R that has date values in
I've just read in a file that is something like: name: john, jane car:
I'm trying to read a binary file that consists of 2 byte floats, but
I am using java to read a TSV file that is 4gb in size
I have semicolon-separated .dat file and I want to read that file and store
I was wondering if it was possible to read a text file that was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.