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 8419259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:33:41+00:00 2026-06-10T02:33:41+00:00

I have a csv file with binary data inline with text (ie Text,0xFF00). I

  • 0

I have a csv file with binary data inline with text (ie Text,0xFF00). I need to read in both values and save them into a database. Currently I’m using a StreamReader to read in the line and splitting it by the comma. The issue I’m having is I need to convert the binary data into it’s byte[] equivalent (ie 0xFF00 goes to {255,0}). Any kind of conversion with encoding will change the binary.

byte[] data= System.Text.Encoding.ASCII.GetBytes(SplitString[1]);

If the entire file was binary I could use File.ReadAllBytes(file) Is there a way to do this in memory without writing out the binary portion to a temporary file?

  • 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-06-10T02:33:42+00:00Added an answer on June 10, 2026 at 2:33 am

    I have a csv file with binary data inline with text

    That’s a bad start. Any chance you could change it?

    Basically, you shouldn’t try to read binary data as text in the first place. Doing so will almost certainly lose data. (You could use ISO-Latin-1, but it’s an icky workaround for a nasty problem.)

    Instead, you’ll probably want to read all the data as binary, and convert only the relevant bits of it to text using Encoding.GetString.

    How do you know which bits of your file are meant to be what in your file? (i.e. which bits are binary and which bits are text)

    The issue I’m having is I need to convert the binary data into it’s byte[] equivalent (ie 0xFF00 goes to {255,0}).

    Just to check, your file really does contain the binary data, not a hex representation of the binary data, right? If it’s actually all text data, but some of it is binary data encoded into text using hex, that’ll make life much easier.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a CSV file with around 1.8million rows. I need to insert them
I have csv file having some address data mostly in Finnish language. I need
i have csv files, java app and database, i read csv file from my
How to read and import .csv file in groovy on grails. I have .csv
I have CSV file with sample data in this form : 220 30 255
I have a strange problem: I have a CSV file that I read correctly
I have csv file exported from access. (dates formatted to match mysql) I need
I have a CSV file in the following format: id,code,date,address,complete_url Example data from the
I have a problem with writting this program I need to read a csv
i have an ashx file that creates a binary csv file for me. i'd

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.