Converting vb codes to C

Posted on 2002-07-16
Last Modified: 2010-04-15
 Open App.Path & "\test" For Binary Access Read As #1
    lngSize = LOF(1)
    If lngSize <> 204855 Then
      MsgBox "The exe has been tempered. Active failed !", vbInformation, "Error"
      Exit Function
    End If
    Get #1, , arryByte
  Close #1
  arryByte(1001) = arryByte(1001) + 100

  Open App.Path & "\test" For Binary Access Write As #2
    Put #2, , arryByte
  Close #2

Above is my VB codes. Can experts help me out to convert
it into C program ?

Thanks !
Question by:tryforum
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 23

Accepted Solution

Roshan Davis earned 130 total points
ID: 7164419
This is a rough work, may be have simple errors,
 Try it

#include <stdio.h>
#include <malloc.h>

void main( void )
   FILE *stream;
   int fhandle;
   int filesize;
   char *pchArrayByte;

   if( (stream = fopen( "test", "r" ))  )
          // get handle to the file and determine file size
          fhandle = fileno(stream);
          filesize = filelength(fhandle);

          if ( 204855 != filesize )
               printf("The exe has been tempered. Active failed !");

          pchArrayByte = (char*)malloc(204855);

          numread = fread( pchArrayByte, sizeof( char ), 204855, stream );


          pchArrayByte[1001] += 100;

          if( (stream = fopen( "test", "w" ))  )
               fwrite( pchArrayByte, sizeof( char ), 204855, stream );


Author Comment

ID: 7170488
Let me test it out and will let you know ! Thanks
LVL 23

Expert Comment

by:Roshan Davis
ID: 7184352

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to design, and implement simple interface 5 141
How do I install gcc 4.8.4 on a Linux Ubuntu 14.04 machine? 5 2,362
negation in C function 14 179
C#, VS15, StructLayout 1 137
This tutorial is posted by Aaron Wojnowski, administrator at  To view more iPhone tutorials, visit This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question