Binary file Browser

Source: Internet
Author: User

Enter the code:

/* Copyright (c) 2014, Yantai University School of Computer * All rights reserved. * File name: Sum123.cpp * Author: Lin Haiyun * Completion Date: August 19, 2015 * Version number: v2.0 * * Problem Description: Do a similar binaryviewer view binary files, enter the file name, can be 16 binary The contents of the file are listed in the ASCII-controlled manner * Input Description: Enter the file name; * Program output: The contents of the file in 16 binary format output */#include <fstream> #include <string> #include    <iostream> #include <iomanip> #include <cstdlib>using namespace Std;int main () {char c[16];    Char f[100];    cout<< "Please enter the file name:";    cin>>f;    Ifstream infile (f,ios::in|ios::binary); if (!infile) {cerr<< "Open error!"        <<endl;    Abort ();        } while (!infile.eof ()) {infile.read (c,16); if (!infile.eof ()) {for (int i=0; i<16; i++) Cout<<setfill (' 0 ') &LT;&LT;SETW (2) &lt                                                                                  ; 

Operation Result:


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Binary file Browser

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.