Click here to Skip to main content
15,896,912 members
Home / Discussions / C#
   

C#

 
QuestionRe: How can I write string to a memory mapped file? Pin
Richard MacCutchan2-May-15 3:33
mveRichard MacCutchan2-May-15 3:33 
AnswerRe: How can I write string to a memory mapped file? Pin
Member 116587422-May-15 4:17
Member 116587422-May-15 4:17 
GeneralRe: How can I write string to a memory mapped file? Pin
Richard MacCutchan2-May-15 4:23
mveRichard MacCutchan2-May-15 4:23 
GeneralRe: How can I write string to a memory mapped file? Pin
Member 116587422-May-15 4:34
Member 116587422-May-15 4:34 
GeneralRe: How can I write string to a memory mapped file? Pin
Richard MacCutchan2-May-15 4:56
mveRichard MacCutchan2-May-15 4:56 
GeneralRe: How can I write string to a memory mapped file? Pin
Member 116587422-May-15 5:19
Member 116587422-May-15 5:19 
GeneralRe: How can I write string to a memory mapped file? Pin
Richard MacCutchan2-May-15 5:28
mveRichard MacCutchan2-May-15 5:28 
GeneralRe: How can I write string to a memory mapped file? Pin
OriginalGriff2-May-15 4:30
mveOriginalGriff2-May-15 4:30 
Basically what the error is saying is "you can't do that at all".
A struct is a value type - it contains all it's information directly within the struct itself, and teh size is always fixed at compile time. "Basic types" such as int, float, and double are also value types.
A string is a reference type - the variable you declare is not the string itself but a reference to the memory that actually contains the string data - the reference itself is a fixed size, but teh data it refers to is not.

The error message is saying "you can only give me fixed size data" - a value type, not a reference type - and that it cannot contain any references.

So the struct you pass through can only contain basic types, and structs containing basic types - no reference types, which means no strings, no arrays, no Lists, nothing complex at all.

I suspect you are going to have to find a better solution to your problem, and drop the idea of memory mapped files altogether. What exactly are you trying to do that you think you need these?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

GeneralRe: How can I write string to a memory mapped file? Pin
Member 116587422-May-15 4:40
Member 116587422-May-15 4:40 
GeneralRe: How can I write string to a memory mapped file? Pin
OriginalGriff2-May-15 4:54
mveOriginalGriff2-May-15 4:54 
GeneralRe: How can I write string to a memory mapped file? Pin
Member 116587422-May-15 5:11
Member 116587422-May-15 5:11 
AnswerRe: How can I write string to a memory mapped file? Pin
Sascha Lefèvre2-May-15 5:25
professionalSascha Lefèvre2-May-15 5:25 
QuestionHelp me, I need a simple program examples. Pin
Member 114460801-May-15 20:55
Member 114460801-May-15 20:55 
AnswerRe: Help me, I need a simple program examples. Pin
OriginalGriff1-May-15 21:16
mveOriginalGriff1-May-15 21:16 
QuestionProblem in killing both Application.exe and launched process Extract.exe from Application.exe in multiple instances environment Pin
shivmymail1-May-15 19:02
shivmymail1-May-15 19:02 
AnswerRe: Problem in killing both Application.exe and launched process Extract.exe from Application.exe in multiple instances environment Pin
OriginalGriff1-May-15 19:34
mveOriginalGriff1-May-15 19:34 
GeneralRe: Problem in killing both Application.exe and launched process Extract.exe from Application.exe in multiple instances environment Pin
shivmymail1-May-15 19:40
shivmymail1-May-15 19:40 
GeneralRe: Problem in killing both Application.exe and launched process Extract.exe from Application.exe in multiple instances environment Pin
OriginalGriff1-May-15 19:44
mveOriginalGriff1-May-15 19:44 
GeneralRe: Problem in killing both Application.exe and launched process Extract.exe from Application.exe in multiple instances environment Pin
shivmymail1-May-15 20:05
shivmymail1-May-15 20:05 
Questionhow can reading bytes Pin
hasan hadi1-May-15 3:42
hasan hadi1-May-15 3:42 
AnswerRe: how can reading bytes Pin
Eddy Vluggen1-May-15 4:25
professionalEddy Vluggen1-May-15 4:25 
AnswerRe: how can reading bytes Pin
OriginalGriff1-May-15 4:34
mveOriginalGriff1-May-15 4:34 
GeneralRe: how can reading bytes Pin
hasan hadi1-May-15 4:54
hasan hadi1-May-15 4:54 
GeneralRe: how can reading bytes Pin
OriginalGriff1-May-15 5:07
mveOriginalGriff1-May-15 5:07 
GeneralRe: how can reading bytes Pin
hasan hadi1-May-15 5:53
hasan hadi1-May-15 5:53 

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.