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

  • Home
  • SEARCH
  • 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 6371785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:07:53+00:00 2026-05-25T01:07:53+00:00

this is the code in question: using (var file = MemoryMappedFile.OpenExisting(AIDA64_SensorValues)) { using (var

  • 0

this is the code in question:

using (var file = MemoryMappedFile.OpenExisting("AIDA64_SensorValues"))
{
    using (var readerz = file.CreateViewAccessor(0, 0))
    {
        var bytes = new byte[567];
        var encoding = Encoding.ASCII;
        readerz.ReadArray<byte>(0, bytes, 0, bytes.Length);

        File.WriteAllText("C:\\myFile.txt", encoding.GetString(bytes));

        var readerSettings = new XmlReaderSettings { ConformanceLevel = ConformanceLevel.Fragment };
        using (var reader = XmlReader.Create("C:\\myFile.txt", readerSettings))
        {

This is what myfile.txt looks like:

<sys><id>SCPUCLK</id><label>CPU Clock</label><value>1598</value></sys><sys><id>SCPUFSB</id><label>CPU FSB</label><value>266</value></sys><sys><id>SMEMSPEED</id><label>Memory Speed</label><value>DDR2-667</value></sys><sys><id>SFREEMEM</id><label>Free Memory</label><value>415</value></sys><sys><id>SGPU1CLK</id><label>GPU Clock</label><value>562</value></sys><sys><id>SFREELVMEM</id><label>Free Local Video Memory</label><value>229</value></sys><temp><id>TCPU</id><label>CPU</label><value>42</value></temp><temp><id>TGPU1</id><label>GPU</label><value>58</value></temp>

if i write the data to a txt file on the hard drive with:

File.WriteAllText("C:\\myFile.txt", encoding.GetString(bytes));

then read that same text file with the fragment XmlReader:

 XmlReader.Create("C:\\myFile.txt");

it reads it just fine, the program runs and completes like it supposed to, but then if i directly read with the fragment XmlReader like:

XmlReader.Create(encoding.GetString(bytes));

I get exception when run ” illegal characters in path” on the XmlReader.Create line.

ive tried writing it to a separate string first and reading that with xmlreader, and it wouldn’t help to try to print it to CMD to see what it looks like because CMD wouldnt show the invalid characters im dealing with right?

but oh well i did Console.WriteLine(encoding.GetString(bytes)); and it precisely matched the txt file.

so somehow writing it to the text file is removing some “illegal characters”? what do you guys think?

  • 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-25T01:07:54+00:00Added an answer on May 25, 2026 at 1:07 am
    XmlReader.Create(encoding.GetString(bytes));
    

    XmlReader.Create() interprets your string as the URI where it should read a file from. Instead encapsulate your bytes in a StringReader:

    StringReader sr = new StringReader(encoding.GetString(bytes));
    XmlReader.Create(sr);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the code I posted as an answer to this question to
This is a really basic question but... I have some code like this var
I have a question concerning this code which I want to run on QNX:
Note : The code in this question is part of deSleeper if you want
Reading this question I found this as (note the quotation marks) code to solve
This would be a question for anyone who has code in the App_Code folder
Expanding this question on how I learnt to pass from problem description to code
(EDIT: This question is now outdated for my particular issue, as Google Code supports
Following on from this question I now have code that can attach to a
Similar to this question , after running the following code the browser dialog does

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.