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

  • SEARCH
  • Home
  • 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 7880249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:05:59+00:00 2026-06-03T04:05:59+00:00

#include <stdio.h> #include <iostream> int main() { FILE* oFile=fopen(file,wb); for(int i = 255; i>=0;

  • 0
#include <stdio.h>
#include <iostream>


int main()
{
    FILE* oFile=fopen("file","wb");

    for(int i = 255; i>=0; i--)
        fprintf(oFile,"%c",i);

    system("pause");
    return 0;
}

Now, “file” contains ONLY “weird” characters:

����훗퓕틓탑컏쳍쫋죉웇쓅싃상뺿벽못뢹뚷뒵늳낱꺯겭ꪫꢩꚧ꒥ꊣꂡ麟鲝骛颙隗钕銓邑躏貍誋袉蚇蒅芃肁繿籽穻硹癷瑵牳灱湯汭橫桩晧摥扣恡幟屝婛塙噗呕剓偑乏䱍䩋䡉䙇䑅䉃䁁㸿㰽㨻㠹㘷㐵㈳〱ⸯⰭ⨫⠩☧␥∣‡ḟᰝᨛ᠙ᘗᐕሓထฏ఍਋ࠉ؇Ѕȃ

What’s intriguing for me, using a console stream, everything is OK.

#include <stdio.h>
#include <iostream>




int main()
{


    for(int i = 255; i>=0; i--)
        printf("%c",i);

    system("pause");
    return 0;
}

The question is: why there are no “latin” characters in the output file? Even after converting from UCS-2 little endian(why it was automagically selected?) to ascii in the notepad++:

ﳽ﫻ď±î»Żîł­î««îŁ©î›§î“Ąî‹Łîˇí»źíłťí«›íŁ™í›—í“•í‹“í‘컏쳍쫋죉웇쓅ě‹ě뺿벽못뢹뚷뒵늳낱꺯겭ꪫꢩꚧ꒥ꊣꂡ麟鲝骛颙隗钕銓邑躏貍誋袉蚇蒅čŠč‚繿籽穻硹癷瑵牳ç±ćąŻć±­ć©«ćˇ©ć™§ć‘Ąć‰Łćˇĺąźĺ±ťĺ©›ĺˇ™ĺ™—呕剓ĺ‘乏䱍䩋䡉䙇䑅ä‰ä㸿㰽㨻㠹ă·ăµăłă€±â¸Żâ°­â¨«â ©â§âĄâŁâ€ˇá¸źá°ťá¨›á ™á—á•á“ထฏ఍਋ࠉ؇ЅČ

  • 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. Editorial Team
    Editorial Team
    2026-06-03T04:06:00+00:00Added an answer on June 3, 2026 at 4:06 am

    I think that one problem you have is that you happen to have started your file with a well known byte order mark, “feff” which is the BOM for UTF-16. This means that many editors will think this is UTF16 where they’d normally default to ASCII/UTF8.

    Take a look at your file in hex:

    00000000  ff fe fd fc fb fa f9 f8  f7 f6 f5 f4 f3 f2 f1 f0  |................|
    00000010  ef ee ed ec eb ea e9 e8  e7 e6 e5 e4 e3 e2 e1 e0  |................|
    00000020  df de dd dc db da d9 d8  d7 d6 d5 d4 d3 d2 d1 d0  |................|
    00000030  cf ce cd cc cb ca c9 c8  c7 c6 c5 c4 c3 c2 c1 c0  |................|
    00000040  bf be bd bc bb ba b9 b8  b7 b6 b5 b4 b3 b2 b1 b0  |................|
    00000050  af ae ad ac ab aa a9 a8  a7 a6 a5 a4 a3 a2 a1 a0  |................|
    00000060  9f 9e 9d 9c 9b 9a 99 98  97 96 95 94 93 92 91 90  |................|
    00000070  8f 8e 8d 8c 8b 8a 89 88  87 86 85 84 83 82 81 80  |................|
    00000080  7f 7e 7d 7c 7b 7a 79 78  77 76 75 74 73 72 71 70  |.~}|{zyxwvutsrqp|
    00000090  6f 6e 6d 6c 6b 6a 69 68  67 66 65 64 63 62 61 60  |onmlkjihgfedcba`|
    000000a0  5f 5e 5d 5c 5b 5a 59 58  57 56 55 54 53 52 51 50  |_^]\[ZYXWVUTSRQP|
    000000b0  4f 4e 4d 4c 4b 4a 49 48  47 46 45 44 43 42 41 40  |ONMLKJIHGFEDCBA@|
    000000c0  3f 3e 3d 3c 3b 3a 39 38  37 36 35 34 33 32 31 30  |?>=<;:9876543210|
    000000d0  2f 2e 2d 2c 2b 2a 29 28  27 26 25 24 23 22 21 20  |/.-,+*)('&%$#"! |
    000000e0  1f 1e 1d 1c 1b 1a 19 18  17 16 15 14 13 12 11 10  |................|
    000000f0  0f 0e 0d 0c 0b 0a 09 08  07 06 05 04 03 02 01 00  |................|
    00000100
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

#include <stdio.h> #include <stdlib.h> int main(int argc,char *argv[]) { system(PAUSE); return 0; } After
#include <stdio.h> #include <string.h> #include <cstdlib> const int KEY=118; int main() { FILE* hOFile
#include <stdio.h> #include <iostream> using namespace std; int main(void) { bool premiereLignefaite = false;
I have a very simple C++ application. #include <stdio.h> #include <iostream> int main(int argc,
here is code for regular expression matching #include<iostream> #include<stdio.h> #include<string.h> using namespace std; int
#include <pthread.h> #include <stdio.h> #include <unistd.h> #include <vector> #include <string> #include <iostream> FILE* fp;
i have a file with only import: #include <iostream> #include <stdio.h> #include cxcore.hpp #include
// diskbin.cpp : main project file. #include stdafx.h #include <windows.h> #include <iostream> #include <fstream>
Say you've got the following simple main.cpp file: #include <cstdlib> #include <iostream> #include <fstream>
This works: #include <iostream> using namespace std; but this fails: #include <stdio> When is

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.