Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
A

aldogon

@aldogon
About
Posts
4
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • VB6 --> C# Binary file reading
    A aldogon

    Hi, this is the code i've been trying to convert from VB6 to C#...Is there any way to avoid reading every field of the struct and reaing the whole thing? VB6 code: -------------------------------------------------------- Type Person sName as String * 12 Age as Byte Code as Long End Type private persons() as Person Sub LoadData(path As String) dim hf as long hf = FreeFile dim recs as long dim offset as long open path for binary access read lock write as #hf get #hf, 1, recs get #hf, , offset if recs > 0 redim persons(1 to recs) '' Very easy way to retrieve UDT array data get #hf, offset + 1, persons() end if End Sub C#: ------------------------------------------------------- using System; using System.IO; using System.Runtime.InteropServices; //[StructLayout(LayoutKind.Sequential)] public struct Person { [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 12)] string Name; byte Age; int Code; } public class PersonReader { private Person[] persons; private void LoadData(string path) { Stream fileContents = File.Open(path, FileMode.Open); BinaryReader binReader = new BinaryReader(fileContents); int recs = binReader.ReadInt32(); int offset = binReader.ReadInt32(); binReader.BaseStream.Position = offset; //Something like this should go here: persons = binReader(...//read till the eof and convert it to Person[] :P // Instead of a code that reads each data of the struct binReader.Close(); fileContents.Close(); } }

    C# csharp data-structures question

  • .net framework 1.1 in visual studio 2002
    A aldogon

    Does it ensure that the IDE will use the 1.1 framework?

    Visual Studio csharp visual-studio dotnet question announcement

  • .net framework 1.1 in visual studio 2002
    A aldogon

    Hi. I use Visual Studio 2002 and I just installed the .net framework 1.1 and its SDK but the IDE keeps using the 1.0 framework. Is there a way to update it?

    Visual Studio csharp visual-studio dotnet question announcement

  • Contest winners
    A aldogon

    How can i find the contest winner articles in the site? not just the recent but all:)

    Site Bugs / Suggestions question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups