jaredgalen
Programmer
There seems to be a few more people using this forum so here's the Question.
I have a program that reads in a 32-digit hex number from the command line:
ie. findkey a3 1f 2e 3c 4e 5a f6 a3 1f 2e 37 d5 66 1a 33 3c
I take this and split it up into two arrays.
The first 8 go into the input[] array.
The next 8 go into the cipherInput[] array as in the code below.
What I need to do is instead of taking it from the command line, I want to read it from two files.
The first 8 will come from one file, the last 8 will come from another file.
I had been passing it from java, but that was a temp hack.
Can someone help me with this.
//current code//
for (i=0;i<8;i++)
sscanf(argv,"%x",&input); //reading from cmd line
for (i=8;i<16;i++)
sscanf(argv,"%x",&cipherInput[i-8]);
for (i=0;i<8;i++)
data=input[7-i];
//putting into the arrays
for (i=0;i<8;i++)
cipherData=cipherInput[7-i];
In summary I need to:
Read in from the first file and put that into input[]
Read in from the second file and put that into cipherInput[]
I have to read from the same line number in each file, both files are gauranteed to have the same number of lines.
Each file format is:
a3 1f 2e 3c 4e 5a f6 a3
1f 2e 37 d5 66 1a 33 3c
.
.
.
I have a program that reads in a 32-digit hex number from the command line:
ie. findkey a3 1f 2e 3c 4e 5a f6 a3 1f 2e 37 d5 66 1a 33 3c
I take this and split it up into two arrays.
The first 8 go into the input[] array.
The next 8 go into the cipherInput[] array as in the code below.
What I need to do is instead of taking it from the command line, I want to read it from two files.
The first 8 will come from one file, the last 8 will come from another file.
I had been passing it from java, but that was a temp hack.
Can someone help me with this.
//current code//
for (i=0;i<8;i++)
sscanf(argv,"%x",&input); //reading from cmd line
for (i=8;i<16;i++)
sscanf(argv,"%x",&cipherInput[i-8]);
for (i=0;i<8;i++)
data=input[7-i];
//putting into the arrays
for (i=0;i<8;i++)
cipherData=cipherInput[7-i];
In summary I need to:
Read in from the first file and put that into input[]
Read in from the second file and put that into cipherInput[]
I have to read from the same line number in each file, both files are gauranteed to have the same number of lines.
Each file format is:
a3 1f 2e 3c 4e 5a f6 a3
1f 2e 37 d5 66 1a 33 3c
.
.
.