Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6046153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:12:21+00:00 2026-05-23T07:12:21+00:00

I will try to make this as straight forward as possible. This question does

  • 0

I will try to make this as straight forward as possible. This question does not simply involve reading and writing bytes. I am looking for an exact translation between this VB6 code and C# code. I know this is not always a posibility but I’m sure someone out there has some ideas!

VB6 Code & explanation:

The below code writes data into a specific part of the file.

[ Put [#]filenumber, [byte position], varname ].

It is the *byte position * that I am having trouble figuring out – and help with this would be very much appreciated!

Dim file, stringA as string

Open file for Binary As #1
    lPos = 10,000
    stringA = "ThisIsMyData"
Put #1, lPos, stringA

Close #1

So, I am looking for some help with the byte position, once again. In this example the byte position was represented by lPos.

EDIT FOR HENK –

I will be reading binary data. There are some characters in this binary data that I will need to replace. For this reason, I will be using VB6’s instr function to get the poisition of this data (there lengths are previously known). I will then use Vb6’s Put function to write this data at the newfound position. This will overwrite the old data with the new data. I hope this helped!

If it helps anyone, here is some further information regarding the Put function.

Thanks so much,
Evan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:12:21+00:00Added an answer on May 23, 2026 at 7:12 am

    Can you not use a BinaryWriter?

    For example:

    FileStream fs = new FileStream(file, FileMode.Open);
    BinaryWriter w = new BinaryWriter(fs);
    
    w.Seek(10000, SeekOrigin.Origin);
    w.Write(encoding.GetBytes("ThisIsMyData"));
    
    w.Flush();
    w.Close();
    fs.Close();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, I'll try to make this as straight forward as possible. I'm using VB.Net
Alright, I will try to make this is as simple as possible, without being
Been a tough week, will try to make this as clear as possible. Appreciate
I will try to make this as clear as I can, but if you
I'm fairly new to C# but I will try to make this quick! ;)
I will try to keep this as simple as possible. I have a rather
I will try to make this simple and quick.. I have never attempted this
OKay, I will try to make this make sense lol. Basically I have 4
I will try to make myself as clear as possible. Let start from the
I know this sounds like a subjective answer, but I will try to make

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.