I am trying to write a program using C++ performs XOR operation between a string and a char. The result is stored in a file and read back later. Certain outputs of the XOR operation cause the characters to become control characters like SOH, ACK, STX, BEL. These control characters then stop the program from progressing so it will only write or read half the XOR operation output to the file. I tried using ios::binary mode to avoid this from happening but the problem still persists. Are there any other methods to forcefully avoid control character operation?
Using fstream in c++ to read/write binary data and control characters
801 Views Asked by Iamverystuck At
1
There are 1 best solutions below
Related Questions in C++
- C++ using std::vector across boundaries
- Linked list without struct
- Connecting Signal QML to C++ (Qt5)
- how to get the reference of struct soap inherited in C++ Proxy/Service class
- Why we can't assign value to pointer
- Conversion of objects in c++
- shared_ptr: "is not a type" error
- C++ template using pointer and non pointer arguments in a QVector
- C++ SFML 2.2 vectors
- Lifetime of temporary objects
- I want to be able to use 4 different variables in a select statement in c ++
- segmentation fault: 11, extracting data in vector
- How to catch delay-import dll errors (missing dll or symbol) in MinGW(-w64)?
- How can I print all the values in this linked list inside a hash table?
- Configured TTL for A record(s) backing CNAME records
Related Questions in STRING
- SML - Find same elements in a string
- match hex string with list indice
- How can I determine the index of the same set of characters between two strings that are of different lengths?
- String.replace() isn't working like I expect
- How to do a case-insensitive string comparison?
- Trying to save an np array with string and floats, but getting a error
- String replace with integer not working
- How to calculate a length of array with out using library
- Java replace every Nth specific character (e.g. space) in String
- Split the strings into two parts Python
- Perl Regex: Merge multiple one-character substrings
- Squid S2275 does not know about format string argument indexes
- more efficient way of remove a few characters from the end of a string
- python member str performance too slow
- String.split() not behaving in android
Related Questions in FILE-IO
- python how to write list of lists to file
- Why does command prompt show numbers before I begin?
- How can i access a js file in my project?
- I want to add a string in between of 2 strings in file, but in output whole text is getting appended at the end of file
- Where do I call an async method from?
- FileWriter() will only append, not overwrite
- How to scan several drives for specific directories?
- C language - Read specific data from text file
- NoSuchFileException when creating a file using nio
- How to force project to work only within it's directory?
- dojo 1.10 How to read text file a user has picked with a file picker
- Python Fabric - erasing my remote file when it should be copying to it
- Access Denied when trying to open with File.OpenRead
- Node.js v0.10: Replace certain bytes in file without reading whole file
- How to read a Bunch of files in a directory in lua
Related Questions in BINARY
- Serializing to disk and deserializing Scala objects using Pickling
- Need Helped Understanding an 8-Bit Signed Decimal with 2's Compliment
- writing into file (Converting Base64 to Binary) values Using VFS and ESB 4.8.1
- Store 3 bit binary numbers in C++ array
- Benefits of storing hex in DB over file
- Binary to CSV record Converstion
- Add binary numbers like decimal numbers in Java. eg 0101 + 0110 = 0211
- Reading a line of binary file MATLAB
- Long.parseLong Error
- Reading binary file in Perl
- Fast Random Permutation of Binary Array
- Type safety and NEG instruction
- Populating data from a binary stream using byte array in java
- 1MiB = 1024KiB = 2^10. Nonetheless, why not use just 1000 byte instead 1024 to calculate size?
- Need help understanding how vectors are represented in binary [C++]
Related Questions in HEX-FILE
- Convert hex to bin file with correct address offset
- Can i get project setting value from hex output file in IAR workbench?
- TortoiseGit commit only specific *.hex files
- Reading .hex File with C# File.ReadAllBytes()
- how to convert .c file to .hex file and load it on AVR microcontroller?
- Read binary file of logging data and output to new file with int (python)
- I'm trying to write emulator for ARM Cortex M3. How can I read the binary file then decode it?
- Trying to replicate a CRC made with ielftool in srec_cat
- PicSimlab 0.7.5 version is shutting down very frequently within 1 minute
- Printing Lines from Intel HEX Record File
- How do I convert an Intel HEX file to raw data like memory view?
- .hex file reading or .bin in python - getting first address value
- how to read non-zero part of intelhex file in python using IntelHex package
- Contiguous Hex file generation using GCC
- Fixing checksum issues on intel HEX files
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Yes, regardless of any control characters, it can be simply stored. Please use unformatted IO funcions of the stream. Please read here and here about unformatted io functions. So, for example put, write or get and read.
Opening the file in binary or text mode will basically make no difference in your application. Please read here abaout the difference of the modes.
With the above know how, the function can be implemented easily.
Please see: