Hey,
I want to insert a character 0x0a after a string in my output to file. To look something like this:
I tried inserting a newline, that's what 0a is, but it write two bites instead of one. I asigned '\n' to an unsigned char and then print it, it doesn't work.Code:one0atwo0athree
The source:
here's the current output, in ASCII:Code:#include<iostream> #include <cstdio> using namespace std; int main (void) { char str1[] = "one", str2[] = "two"; char c = 0xa; FILE *out; out = fopen("h:/c/HexTest.txt", "w"); fprintf(out, "%s%c%s%c", str1, c, str2, c); return 0; }
Hex: 6F 6E 65 0D 0A 74 77 6F 0D 0A.Code:one two
I only want the 0A , without 0D.
Is that doable?
thanks.