Ascii code to Binary code

Hi!

Someone would have a idea how to transform a Text file to a Binary file. For example, I want to converse "42000" in binary, in my binary file.
In first, i tride with function "atoi", but, that give me a strange value.

After, I tried with this instruction:

while(fgets(ligne,100,FileText))
fwrite(ligne,1,sizeof(ligne),FileBin);

But it doen't change the format of the the "42000", when I visualize the Binary File.
Line "42000" as string will be exactly six bytes with values 52, 50, 48, 48, 48, 0.
Any text editor will show these bytes as 42000.

ASCII string value and it binary representation are the same. That is why you do not see any difference.
Topic archived. No new replies allowed.