c++ to vb.net
-
i need to convert #include "stdafx.h" #using using namespace System; int _tmain() { unsigned char a1[16]; unsigned char a2[16]; unsigned int tempWRITE; //FILE *in = fopen("c:/test.bin","r"); FILE *in = fopen("c:/test.bin","rb"); FILE *out = fopen("c:/new.txt","w"); while(!feof(in)) { fread(a1,1,16,in); a2[0] = a1[3]; a2[1] = a1[2]; a2[2] = a1[1]; a2[3] = a1[0]; a2[4] = a1[5]; a2[5] = a1[6]; a2[6] = a1[4]; a2[7] = a1[7]; a2[8] = a1[9]; a2[9] = a1[11]; a2[10] = a1[8]; a2[11] = a1[10]; a2[12] = a1[14]; a2[13] = a1[12]; a2[14] = a1[15]; a2[15] = a1[13]; fwrite(a2,1,16,out); } fclose(in); fclose(out); return 0; } 1. Out of clutter, find simplicity. 2. From discord, find harmony. 3. In the middle of difficulty lies opportunity. Albert Einstein three rules of work
-
i need to convert #include "stdafx.h" #using using namespace System; int _tmain() { unsigned char a1[16]; unsigned char a2[16]; unsigned int tempWRITE; //FILE *in = fopen("c:/test.bin","r"); FILE *in = fopen("c:/test.bin","rb"); FILE *out = fopen("c:/new.txt","w"); while(!feof(in)) { fread(a1,1,16,in); a2[0] = a1[3]; a2[1] = a1[2]; a2[2] = a1[1]; a2[3] = a1[0]; a2[4] = a1[5]; a2[5] = a1[6]; a2[6] = a1[4]; a2[7] = a1[7]; a2[8] = a1[9]; a2[9] = a1[11]; a2[10] = a1[8]; a2[11] = a1[10]; a2[12] = a1[14]; a2[13] = a1[12]; a2[14] = a1[15]; a2[15] = a1[13]; fwrite(a2,1,16,out); } fclose(in); fclose(out); return 0; } 1. Out of clutter, find simplicity. 2. From discord, find harmony. 3. In the middle of difficulty lies opportunity. Albert Einstein three rules of work
hi, well here is an atempt since i'm not that great at c++!
Public Sub t_Main() 'declare the variables Dim a1(16) As Char Dim a2(16) As Char Dim tempWRITE As Integer 'use streamreader to open file Dim fs As StreamReader = New StreamReader("c:/test.bin") 'read file into a1 fs.Read(a1, 0, 16) fs.Close() a2(0) = a1(3) a2(1) = a1(2) a2(2) = a1(1) a2(3) = a1(0) a2(4) = a1(5) a2(5) = a1(6) a2(6) = a1(4) a2(7) = a1(7) a2(8) = a1(9) a2(9) = a1(11) a2(10) = a1(8) a2(11) = a1(10) a2(12) = a1(14) a2(13) = a1(12) a2(14) = a1(15) a2(15) = a1(13) 'use streamwriter to write file Dim sw As StreamWriter = New StreamWriter("c:/new.txt") 'write a2 to file sw.Write(Convert.ToString(a2), 0, 16) sw.Close() End Sub
just call t_Main() in a procedure or click of a button! should be nice and easy!:-O -
hi, well here is an atempt since i'm not that great at c++!
Public Sub t_Main() 'declare the variables Dim a1(16) As Char Dim a2(16) As Char Dim tempWRITE As Integer 'use streamreader to open file Dim fs As StreamReader = New StreamReader("c:/test.bin") 'read file into a1 fs.Read(a1, 0, 16) fs.Close() a2(0) = a1(3) a2(1) = a1(2) a2(2) = a1(1) a2(3) = a1(0) a2(4) = a1(5) a2(5) = a1(6) a2(6) = a1(4) a2(7) = a1(7) a2(8) = a1(9) a2(9) = a1(11) a2(10) = a1(8) a2(11) = a1(10) a2(12) = a1(14) a2(13) = a1(12) a2(14) = a1(15) a2(15) = a1(13) 'use streamwriter to write file Dim sw As StreamWriter = New StreamWriter("c:/new.txt") 'write a2 to file sw.Write(Convert.ToString(a2), 0, 16) sw.Close() End Sub
just call t_Main() in a procedure or click of a button! should be nice and easy!:-OThanks for the start but its out put is not right. I am only getting the first line of the file. it is not a txt file but a .bin if i try a text file it works fine. any help. 1. Out of clutter, find simplicity. 2. From discord, find harmony. 3. In the middle of difficulty lies opportunity. Albert Einstein three rules of work -- modified at 22:48 Monday 23rd January, 2006
-
Thanks for the start but its out put is not right. I am only getting the first line of the file. it is not a txt file but a .bin if i try a text file it works fine. any help. 1. Out of clutter, find simplicity. 2. From discord, find harmony. 3. In the middle of difficulty lies opportunity. Albert Einstein three rules of work -- modified at 22:48 Monday 23rd January, 2006