Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: Memory mapped file questions

by faustf (Novice)
on Oct 09, 2020 at 20:26 UTC ( #11122645=note: print w/replies, xml ) Need Help??


in reply to Re: Memory mapped file questions
in thread Memory mapped file questions

Thanks for answer, i don't have a real file in HDD, C# create a data-file directly in memory ,i never used hexdump , your example include a path to file , what should I call ? thanks

Replies are listed 'Best First'.
Re^3: Memory mapped file questions
by Corion (Pope) on Oct 10, 2020 at 07:55 UTC

    How much of your C# code do you understand?

    Reading your code, there is the line:

    MemoryMappedFile.CreateOrOpen("Test", 1000, MemoryMappedFileAccess.Rea +dWrite);

    This suggests that the code opens or creates a file named Test in the current directory, and as jcb suggests, you could use that as the filename.

    If this is your code, maybe you want to use a different approach than a memory mapped file. If this is not your code, consider talking to the original author about using a different serialization scheme, like JSON, or a well-defined binary layout, or just not using a memory mapped file when a plain file will do just as well.

      Msdn docet MemoryMappedFile.CreateOrOpen Metod: Creates a new empty memory-mapped file or opens an existing one IF one with the same name exists. (i assure not exist a file in my HDD with name Test ) if i wanted to open a file i would used this MemoryMappedFile.CreateFromFile Create a memory-mapped file from a disk file.

        If you don't create the file on disk, how do you expect Perl to read from that file?

        My suggestion to you is to look at other approaches of passing data to another program than using an unnamed memory mapped file.

Re^3: Memory mapped file questions
by jcb (Parson) on Oct 09, 2020 at 21:03 UTC

    Your C# code appears to be creating a file named "Test" in its current directory. You will want perl to open that file.

    Note that synchronization between memory-mapped files and the rest of the filesystem API is usually unspecified until msync() or its equivalent is called or the file is unmapped, so your data may not be actually written to the file until your C# program exits or performs some kind of synchronization call.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11122645]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2021-09-28 00:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?