how to transfer string variable to array variable?

I am planning to transfer a txt file to another txt file.
in the first file for example "1.txt".
there are characters of hexadecimal.
such as "02 1B 5B 01 18 E8 1B 43 40 0B 10 00 92 01 00 00"
although I can read them through s[i] one by one.but it is not convieniant.
I want to transfer the data into array[i],each element has two characters such as"02"or"1B".so I can change it into decimal easily.

can anybody help?
Why not just use iostreams? iostreams can parse hexadecimal into integers directly and format them in decimal.
I learned from below
http://www.cplusplus.com/reference/iostream/
but I can't find function to do this job.can you point out its name?
PanGalactic saidWhy not just use iostreams? iostreams can parse hexadecimal into integers directly and format them in decimal. But namespace std; is actually what you are thinking of. iostream actually only takes care of input & output.
@ clover leaf

Try not to answer questions you don't really understand.

You'll spend your time better served learning first, then you can be in a position to help effectively.
Last edited on
I want to get characters from txt file . and convert to hexadecimal array.
s[i]<<hex<<fgetc(fi);
but the compiler occur error below:


61 C:\Program Files\DEV-CPP\test.cpp invalid operands of types `char' and `std::ios_base&()(std::ios_base&)' to binary `operator<<'

who can tell me what to do?
You don't seem to understand the syntax for using << and >>. Look up how to do file I/O in C++ and then move on to your problem.
Topic archived. No new replies allowed.