Trying to dump an "unsigned char" array to file!
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Trying to dump an "unsigned char" array to file!

Threaded View

  1. #1
    Join Date
    Jun 2012
    Posts
    37

    Question Trying to dump an "unsigned char" array to file!

    Hi there! How are you?

    My problem is fairly simple for those used to CLI programming!

    I basically have an "unsigned char" type array that I need to dump to a file and later be able to read it back, like an EEPROM memory. It's quite simple, but I am having difficulty to find the information on how that could be accomplished. I tried to use StreamWriter but I did not succeed. The code bellow compiles, but all I get is the "System.Byte[]" message on the created file...

    Code:
    array<unsigned char>^ array3 = gcnew array<unsigned char>(8);
    
    array3[0]=10;
    array3[1]=77;
    array3[2]=24;
    array3[3]=56;
    array3[4]=17;
    array3[5]=76;
    array3[6]=72;
    array3[7]=05;
    
    String^ fileName = "textfile.txt";
    StreamWriter^ sw = gcnew StreamWriter(fileName);
    sw->Write(array3);
    sw->Close();
    Edit: And ah! After I succeed writing it, how to read it back??

    Any help will be greatly appreciated!

    Thanks!
    Last edited by fernando306; December 27th, 2012 at 10:35 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center