Click here to Skip to main content
15,867,594 members
Home / Discussions / C#
   

C#

 
AnswerRe: How do you offload a Dictionary? Pin
Abhinav S22-Aug-12 20:29
Abhinav S22-Aug-12 20:29 
QuestionTaskFactory AutoResetEvent DeadLock on Window Service Pin
d87c22-Aug-12 14:14
d87c22-Aug-12 14:14 
Questionnecesito un ejemplo que convierta documentos a imagen utilizando c# Pin
david_33322-Aug-12 8:54
david_33322-Aug-12 8:54 
AnswerRe: necesito un ejemplo que convierta documentos a imagen utilizando c# Pin
Eddy Vluggen22-Aug-12 9:05
professionalEddy Vluggen22-Aug-12 9:05 
GeneralRe: necesito un ejemplo que convierta documentos a imagen utilizando c# Pin
OriginalGriff22-Aug-12 20:27
mveOriginalGriff22-Aug-12 20:27 
GeneralRe: necesito un ejemplo que convierta documentos a imagen utilizando c# Pin
Richard MacCutchan22-Aug-12 21:17
mveRichard MacCutchan22-Aug-12 21:17 
GeneralRe: necesito un ejemplo que convierta documentos a imagen utilizando c# Pin
OriginalGriff22-Aug-12 21:19
mveOriginalGriff22-Aug-12 21:19 
QuestionHow to write to Structured file? Pin
Ubun2OS22-Aug-12 7:39
Ubun2OS22-Aug-12 7:39 
i have a txt Structured file as Ascii. i can read information of that file as structure.
that structure is same as follow:

C#
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
        private struct Header
        {
            public byte version;
            public Int32 numRecords;
            public Int16 headerLen;
            public Int16 recordLen;
            public byte encryptionFlag;
            public Int64 reserved;
            ....
        }

when writing in file , i need to change one /two field of file e.g numRecords.
how can i write this instance file writing? i tried following code but file destroyed and i couldn't read file
C#
using (OpenFileDialog of=new OpenFileDialog())
           {
               of.ShowDialog();
               FileStream fs = new FileStream(of.FileName,FileMode.Open,FileAccess.ReadWrite);
               BinaryWriter bw = new BinaryWriter(fs);
               BinaryReader br = new BinaryReader(fs);

               byte[] buffer = new byte[Marshal.SizeOf(typeof(Header))];

               buffer = br.ReadBytes(Marshal.SizeOf(typeof(Header)));
               GCHandle handle = GCHandle.Alloc(buffer, GCHandleType.Pinned);
               Header rHeader = ((Header)(Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Header))));
               handle.Free();

               Header wHeader = rHeader;
               wHeader.numRecords = 5;
               IntPtr ptr = Marshal.AllocHGlobal(buffer.Length);
               Marshal.StructureToPtr(wHeader, ptr, true);
               Marshal.Copy(ptr, buffer, 0, buffer.Length);
               Marshal.FreeHGlobal(ptr);

               bw.Seek(0, SeekOrigin.Begin);

               bw.Write(buffer);
               bw.Close();
               br.Close();
               fs.Close();
           }

AnswerRe: How to write to Structured file? Pin
Eddy Vluggen22-Aug-12 8:53
professionalEddy Vluggen22-Aug-12 8:53 
QuestionC# 2010 working with xml Pin
sc steinhayse22-Aug-12 3:57
sc steinhayse22-Aug-12 3:57 
AnswerRe: C# 2010 working with xml Pin
BobJanova22-Aug-12 4:32
BobJanova22-Aug-12 4:32 
GeneralRe: C# 2010 working with xml Pin
sc steinhayse22-Aug-12 5:57
sc steinhayse22-Aug-12 5:57 
GeneralRe: C# 2010 working with xml Pin
BobJanova22-Aug-12 6:17
BobJanova22-Aug-12 6:17 
GeneralRe: C# 2010 working with xml Pin
sc steinhayse22-Aug-12 16:37
sc steinhayse22-Aug-12 16:37 
GeneralRe: C# 2010 working with xml Pin
BobJanova22-Aug-12 23:44
BobJanova22-Aug-12 23:44 
QuestionHow to avoid flickering in a user control in .Net Compact Framework/C# ? Pin
topksharma198221-Aug-12 21:27
topksharma198221-Aug-12 21:27 
AnswerRe: How to avoid flickering in a user control in .Net Compact Framework/C# ? Pin
BobJanova22-Aug-12 0:43
BobJanova22-Aug-12 0:43 
GeneralRe: How to avoid flickering in a user control in .Net Compact Framework/C# ? Pin
topksharma198222-Aug-12 1:16
topksharma198222-Aug-12 1:16 
GeneralRe: How to avoid flickering in a user control in .Net Compact Framework/C# ? Pin
BobJanova22-Aug-12 2:10
BobJanova22-Aug-12 2:10 
AnswerRe: How to avoid flickering in a user control in .Net Compact Framework/C# ? Pin
Pete O'Hanlon22-Aug-12 1:27
subeditorPete O'Hanlon22-Aug-12 1:27 
GeneralRe: How to avoid flickering in a user control in .Net Compact Framework/C# ? Pin
topksharma198223-Aug-12 10:16
topksharma198223-Aug-12 10:16 
QuestionRe: How to avoid flickering in a user control in .Net Compact Framework/C# ? Pin
Eddy Vluggen22-Aug-12 3:11
professionalEddy Vluggen22-Aug-12 3:11 
AnswerRe: How to avoid flickering in a user control in .Net Compact Framework/C# ? Pin
topksharma198223-Aug-12 10:16
topksharma198223-Aug-12 10:16 
GeneralRe: How to avoid flickering in a user control in .Net Compact Framework/C# ? Pin
Eddy Vluggen23-Aug-12 10:31
professionalEddy Vluggen23-Aug-12 10:31 
QuestionEPPLUS Excel Pin
Member 916988721-Aug-12 20:48
Member 916988721-Aug-12 20:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.