Questions tagged [file-mapping]

87 questions
0
votes
3 answers

match 2 strings exactly except at places where there is a particular string in python

I have a master file which contains certain text- let's say- file contains x the image is of x type the user is admin the address is x and then there 200 other text files containing texts like- file contains xyz the image if of abc type the user is…
user2715898
  • 921
  • 3
  • 13
  • 20
0
votes
0 answers

How prevent multiple instances of a same module inside my app?

I have code below and my problem is related to foo() function. The problem is that when foo() is executed in a infinite loop with a interval between each execution, is loaded a copy of same dll ( FileName ) that already is present in my app. Eg:…
user7661932
0
votes
0 answers

Memory mapping some data between 2 processes - C++

So I have a first process (process1.cpp) which takes the list of the current processes in the system and should write them in the shared memory alongside their PID and PPID: addr = (LPTSTR)MapViewOfFile(hMapFile, FILE_MAP_ALL_ACCESS, 0, …
miTzuliK
  • 93
  • 1
  • 1
  • 11
0
votes
1 answer

Why doesn't this file-mapped variable get flushed to the disk?

I recently realized that my C skills got a bit rusty and decided to play a bit. I just ended up with a weird behavior though - the file-mapped memory I requested doesn't seem to flush the variable ifs.free_space. The result is that if you don't…
d33tah
  • 10,999
  • 13
  • 68
  • 158
0
votes
2 answers

How to use shared memory correctly under windows

I'm kind of new to shared memory and i was searching for a working example, i managed to find only over MSDN On the first process i've declared my shared memory as following: hFileMapping = ::CreateFileMapping(INVALID_HANDLE_VALUE, nullptr,…
igal k
  • 1,883
  • 2
  • 28
  • 57
0
votes
0 answers

How to fragmentary map large text file in memory using Visual C++?

I have a large plain text file with size of 20GB on disk. Lets name this file as "MyFile.txt". This file contains only english languge words and one string with value of "+++". Lets name this string as FlagString. From the beginig of MyFile.txt to…
user3769902
  • 415
  • 2
  • 5
  • 20
0
votes
0 answers

How to CopyMemory to copy struct using FileMapping?

I have following code, after CopyMemory my pBuf is empty, it contains no data from newCommand, or when I want to add something in that struct it doesnt work... What am I doing wrong? struct StCommand { TCHAR sourcePath[MAX_PATH]; TCHAR…
Jakub
  • 285
  • 4
  • 21
0
votes
1 answer

How Message reads value by taking LPTSTR variable as parameters in visual c++?

I tried an example from MSDN that shows how to read and write using fileMapping functions. I am pasting the code here for you reference from MSDN. The link is…
0
votes
1 answer

error when access data from boost mapped_region

I have some trouble when visit mapped_region data. First, I define a struct: (for stock quotes...) struct bar{ double open,high,low,close; size_t volume; bar(double _open, double _high, double _low, double _close): open(_open),high(_high),…
0
votes
0 answers

problems with .Net File Mapping

There are two processes: Win32, C++ - writer .Net 4.5, C# - reader first process creates a buffer and sharing for second process. (int)(buffer+0) - until when you can write. (int)(buffer+4) - until when you can read. ... - block…
0
votes
1 answer

Returning boost::interprocess memory-mapped file from function?

How can I put this code in to a function so that I pass a file path and it returns the file-mapped bytes in to a char array? Whenever I have tried I can never read the contents once the function finishes? using boost::interprocess; using…
user997112
  • 29,025
  • 43
  • 182
  • 361
0
votes
1 answer

WaitForSingleObject on a semaphore does not wait, returns immediately

I'm trying to make a simple client-server program using windows file mapping and that uses semaphores. The clients send to the server 2 numbers, the server computes nr1+nr2 and nr1 * nr2. I tried something but it doesn't even work for 1 client and I…
MathMe
  • 101
  • 5
  • 13
0
votes
0 answers

C++ MapVirtualFileEx - Creating multiple maps for faster access

I am using MapVirtualFile to quickly access data from a file. However, this is too slow. I guess it is because the file is huge (300 mb), and I need to read from different locations (for example from the start of the file, then from the end of the…
tmighty
  • 10,734
  • 21
  • 104
  • 218
0
votes
1 answer

FileMapped write access

I try to write to file while it is opened as file mapped from another process and it fails. Please look at fragments of code: access = GENERIC_READ | GENERIC_WRITE; share = FILE_SHARE_READ | FILE_SHARE_WRITE; disposition = OPEN_EXISTING; HANDLE…
Edward83
  • 6,664
  • 14
  • 74
  • 102
0
votes
1 answer

File mapping opening (Windows)

How correctly open/use file mapping on Windows with ability to write to it from another process without file mapping; For example process A writes big log file, it open file, write new data to the end, or rewrite it with new data. Process B in…
Edward83
  • 6,664
  • 14
  • 74
  • 102