C++ File
-
Hi, I have one text file which stores the hex values in different lines(APDU.txt). Eg; 02 01 00 BE 10 04 0E 08 00 06 10 00 2B 61 29 A1 09 06 07 And I need to process this line by line. Here is a sample code that m used so far; FILE *myFile = fopen("D:\\APDU.txt", "rb"); BYTE *buffer,*buffer1; int lengthFile=0; char temp[3]; if(myFile!=NULL) { fseek(myFile,0,SEEK_END); lengthFile=ftell(myFile); fseek(myFile,0,SEEK_SET); buffer=new BYTE[lengthFile+1]; memset(buffer,0,lengthFile+1); fread(buffer,sizeof(BYTE),lengthFile,myFile); fclose(myFile); } buffer1=new BYTE[lengthFile/2]; memset(buffer1,0,lengthFile/2); memset(temp,0,sizeof(temp)); for(int i=0,j=0;i
-
Hi, I have one text file which stores the hex values in different lines(APDU.txt). Eg; 02 01 00 BE 10 04 0E 08 00 06 10 00 2B 61 29 A1 09 06 07 And I need to process this line by line. Here is a sample code that m used so far; FILE *myFile = fopen("D:\\APDU.txt", "rb"); BYTE *buffer,*buffer1; int lengthFile=0; char temp[3]; if(myFile!=NULL) { fseek(myFile,0,SEEK_END); lengthFile=ftell(myFile); fseek(myFile,0,SEEK_SET); buffer=new BYTE[lengthFile+1]; memset(buffer,0,lengthFile+1); fread(buffer,sizeof(BYTE),lengthFile,myFile); fclose(myFile); } buffer1=new BYTE[lengthFile/2]; memset(buffer1,0,lengthFile/2); memset(temp,0,sizeof(temp)); for(int i=0,j=0;i
Do you have some sort of a question?
Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
-
Hi, I have one text file which stores the hex values in different lines(APDU.txt). Eg; 02 01 00 BE 10 04 0E 08 00 06 10 00 2B 61 29 A1 09 06 07 And I need to process this line by line. Here is a sample code that m used so far; FILE *myFile = fopen("D:\\APDU.txt", "rb"); BYTE *buffer,*buffer1; int lengthFile=0; char temp[3]; if(myFile!=NULL) { fseek(myFile,0,SEEK_END); lengthFile=ftell(myFile); fseek(myFile,0,SEEK_SET); buffer=new BYTE[lengthFile+1]; memset(buffer,0,lengthFile+1); fread(buffer,sizeof(BYTE),lengthFile,myFile); fclose(myFile); } buffer1=new BYTE[lengthFile/2]; memset(buffer1,0,lengthFile/2); memset(temp,0,sizeof(temp)); for(int i=0,j=0;i
are you giving us the code ..... or you forgot the question
-
Hi, I have one text file which stores the hex values in different lines(APDU.txt). Eg; 02 01 00 BE 10 04 0E 08 00 06 10 00 2B 61 29 A1 09 06 07 And I need to process this line by line. Here is a sample code that m used so far; FILE *myFile = fopen("D:\\APDU.txt", "rb"); BYTE *buffer,*buffer1; int lengthFile=0; char temp[3]; if(myFile!=NULL) { fseek(myFile,0,SEEK_END); lengthFile=ftell(myFile); fseek(myFile,0,SEEK_SET); buffer=new BYTE[lengthFile+1]; memset(buffer,0,lengthFile+1); fread(buffer,sizeof(BYTE),lengthFile,myFile); fclose(myFile); } buffer1=new BYTE[lengthFile/2]; memset(buffer1,0,lengthFile/2); memset(temp,0,sizeof(temp)); for(int i=0,j=0;i
-
or liquid nitrogen ;P
Regards. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpfull answers is nice, but saying thanks can be even nicer.
-
Hi, I have one text file which stores the hex values in different lines(APDU.txt). Eg; 02 01 00 BE 10 04 0E 08 00 06 10 00 2B 61 29 A1 09 06 07 And I need to process this line by line. Here is a sample code that m used so far; FILE *myFile = fopen("D:\\APDU.txt", "rb"); BYTE *buffer,*buffer1; int lengthFile=0; char temp[3]; if(myFile!=NULL) { fseek(myFile,0,SEEK_END); lengthFile=ftell(myFile); fseek(myFile,0,SEEK_SET); buffer=new BYTE[lengthFile+1]; memset(buffer,0,lengthFile+1); fread(buffer,sizeof(BYTE),lengthFile,myFile); fclose(myFile); } buffer1=new BYTE[lengthFile/2]; memset(buffer1,0,lengthFile/2); memset(temp,0,sizeof(temp)); for(int i=0,j=0;i
Member 8747425 wrote:
memset(buffer,0,lengthFile+1);
Since
buffer
has not been properly initialized, what are you expecting this to do?Member 8747425 wrote:
for(int i=0,j=0;i
Did you fail to notice your incomplete
for()
loop?"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
-
or liquid nitrogen ;P
Regards. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpfull answers is nice, but saying thanks can be even nicer.