×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Ansistring to widestring conversion.

Ansistring to widestring conversion.

Ansistring to widestring conversion.

(OP)
I have a couple of functions that write ansistring to a file or to an internal buffer.
I have been trying to figure out how to convert them to use widestring , can anyone help, Im stuck!

I still need the internal buffer to stay as char.

Thankyou.


void __fastcall TFormMain::WriteDataToFile(int iFileHandle,AnsiString aData)
{
  MemoryOrDisk(iFileHandle,aData.c_str(),aData.Length());
}

void __fastcall TFormMain::MemoryOrDisk(int iFileHandle,char *cData,int iLength)
{
  if(iFileHandle>0)
  {
    FileWrite(iFileHandle,cData,iLength);
  }else
  {
    strncpy(&c_InternalBuffer[l_InternalBufferPosition],cData,iLength);
    l_InternalBufferPosition+=iLength;
  }
}

RE: Ansistring to widestring conversion.

I don't know if this thread is what you are looking for but it might be a start. They start out with a discussion of characters and then move into widestrings.
 

James P. Cottingham
I'm number 1,229!
I'm number 1,229!

RE: Ansistring to widestring conversion.

I'am not sure if I understand your problem well.

But AnsiString has an function dat convert itself to a widestring:

ansiStr.WideChar(dest,int);

ansiStr is an AnsiString.
dest is a wchar_t*

And there are more functions like:
WideString(ansiStr.c_str());

There exist also
<stddef.h>
wchar_t
typedef i-type wchar_t; [keyword in C++]
The type is the integer type i-type of a wide-character constant, such as L'X'. You declare an object of type wchar_t to hold a wide character.
 

RE: Ansistring to widestring conversion.

(OP)
Thankyou for the help !

/Blue

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close