File* pointer as string | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

File* pointer as string

Hi I have pointer to FILE and this FILE* need to be shared across different projects of visual studio... I cannot use additional parameter to pass as function argument for this FILE* One thing I could think of is to use it into registry of windows... As registry can store string (reg_sz) , can I convert FILE* as string and store it to registry and reuse when i need to get FILE*

7th Sep 2021, 8:38 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
2 Answers
0
Thanks Martin Taylor ... 1/2: Yes I can store the file path...I am not worried about path as file path is fixed always. Reason of thought to store the file* is as below: One thread in one project just reads the content of file... This file is written by other thread from two different projects. Reading thread can read all the data written by same project but not data written by other project function. That's why I thought to share file* to Registry... I am opening file* in a+ mode from both the projects currently.... But second project when performs this fopen and successfully writes , first projects on going thread does not read even though file* is valid and not null.
8th Sep 2021, 4:48 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
2/2: I have tried fileattributeset aa read only and normal to avoid reading and writing at same time. Also createfile I have never used... Does it have a+ mode and ability to write CSTRING?
8th Sep 2021, 4:49 AM
Ketan Lalcheta
Ketan Lalcheta - avatar