Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Windows display Little Endian text file

Status
Not open for further replies.

vodkadrinker

Technical User
May 16, 2002
163
GB
I would like to output the contents of a Little Endian text file.

I thought this was quite a simple task but it seems to be not that straight forward, from a Unix point of view I would just use the iconv command does Windows have a similar command or a simple way to do this?
 
Try notepad. File/Save As. Down the bottom, there is a combo box for encoding.
 
Thanks for your reply xwb, I was looking to do it within a c++ program as it is to be part of the output to a socket program I have.
 
Is that file output or socket output?
 
Hi basically the socket program all programs in a directory and the output is from the program is displayed to the socket when a connection is made.

To simplify what I am trying to do if the file wasn't Unicode LE type I could just run the system command, type myfile.txt and that would be ok. Because of the unicode the "type" command doesn't display correctly.
 
He is some example code of how I can do it with the iconv command:-

#include <stdio.h> /* printf */
#include <stdlib.h> /* system, NULL, EXIT_FAILURE */

int main ()
{
int i;
setvbuf(stdout, (char*)NULL, _IONBF, 0);
printf ("MyFile\n");
setvbuf(stdout, (char*)NULL, _IONBF, 0);
if (system(NULL));
else exit (EXIT_FAILURE);
i=system ("iconv -f utf-16le -t utf-8 C:\\myfile.txt");
printf ("\n");
return 0;
}
 
I manged to get one on the c++ guys to take a look and it was not quite as simple as my inital program.

But thanks for trying xwb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top