Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. c++ to vb.net

c++ to vb.net

Scheduled Pinned Locked Moved Visual Basic
csharpc++
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vertig0730
    wrote on last edited by
    #1

    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

    F 1 Reply Last reply
    0
    • V vertig0730

      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

      F Offline
      F Offline
      Fu Manchu
      wrote on last edited by
      #2

      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

      V 1 Reply Last reply
      0
      • F Fu Manchu

        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

        V Offline
        V Offline
        vertig0730
        wrote on last edited by
        #3

        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

        F 1 Reply Last reply
        0
        • V vertig0730

          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

          F Offline
          F Offline
          Fu Manchu
          wrote on last edited by
          #4

          how do you mean the outputs not right? if you change new.txt to new.bin it should be the same, have you put Imports System.IO at the top of your code. I can help you if you give me a better description of the problem?:)

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups