Hi, I am new to C++.Pls help me out.would really appreciate it.

The problem goes like this.

There are two files. In file1(say data1.txt)u have got something like this
Line1:Hello How
Line2:We are fine

the work is grab each string and assign it with a binary file and enter it in a new file(say data2.bin) and every line must correspond to that line from data1.txt

if the String "Hello" corresponds to "0001" and How as "0002" in line 1 then the line 1 of file in data2.bin should like this

"00010002"

Please help me out.

binary files do not have lines -- they are just a stream of bytes that could contain anything between 0 and 255. What you are talking about is a text file, not a binary file.

Post the actual input file, not just an explanation of what it contains.

The first file ( file1.asm) which contains
ADD R1 R2 R3
LOAD R4 R5

has to be converted into the appropriate binary code

For ADD it is 01011
For R1 it is 01110

So my file file2.bin should like
0101101110

Like this, it should compare each and every word and line and then it should produce the output in file2.bin.

Hope this helps for u to help me out.

Why is ADD 01011?
Do you have some table or?

that's what I am wondering too.

thats the appropriate Binary Code for ADD.we have to convert Assembly codes such as ADD into binary digits.I dont have any table. would be great if u could provide with a code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.