|
If you are waiting for the file to be fully created (i.e. completely written), then this code won't work. At best, it will wait until the file is created (i.e. when the other task opens it for writing).
The problem may be broken into two steps:
- Wait until the file is created (i.e. it appears in the directory)
- Wait until the file is closed (i.e. the writing is completed)
Others have given you good ideas about how to wait for the file to be created. In order to wait for the file to be completely written, the best way would be for the other application to create another file AFTER it is done with the data file. For example:
- Your application waits for the creation of DATA.DAT
- Other application creates file DATA.DAT (your application detects the creation)
- Other application writes into DATA.DATA (your application waits for the creation of FINISHED.DAT)
- Other application closes DATA.DAT
- Other application creates FINISHED.DAT (your application detects FINISHED.DAT, and knows that DATA.DAT is ready)
There are some other points to handle (e.g. what happens if DATA.DAT is created before your application starts waiting for it?), but this is the basic idea.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
IF you know that this will be on a local drive, an alternative is to create the file in a different directory and then move it to the target directory.
|
|
|
|
|
Subject to the limitation you mentioned, that would work, too.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Yes, I know VS2008 is old, but I have to use it for a development project.
Anyway, a couple of weeks ago, I installed some software from Intel that broke my VS2008. Nothing would compile, I could not set breakpoints, etc. Using a clean Windows 10 VM, I re-installed VS2008, SP1 and an ATL update required for WEC7 development. I can compile and set breakpoints again. Joy. Now it gets a little weird. The step over (F10) and step into (F11) functions refuse to work. They are being treated as the go (F5) commands, making it just about impossible to get anything done. Note that even the menu debug commands behave this way.
Now it gets a little weird now - it seems to be project/solution related. If I debug project A the functions work, debug Project B (the one I really need to work on) they don't.
So a clean re-install did not fix this, a reset to all settings didn't fix it, deleting .suo, etc files didn't fix it... maddening
Thoughts? Ever run into this?
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
|
You would think, but depending on machine / project the behavior varies.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
It's a long shot, but if the issue is project-specific, then you can try to delete the .suo file from the project directory and re-open the project.
"Five fruits and vegetables a day? What a joke!
Personally, after the third watermelon, I'm full."
|
|
|
|
|
This is a common suggestion - I've done it several times on multiple projects with no success.
The part that I don't get is that the actual menu functions don't work, implying some sort of corruption in VS2008 - *but* that makes no sense since one project will work and the other won't. It should be corrupt for both.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
Another approach is to create a VS2008 valid project and to import all your files from the old one. Then you will have your app settings fresh new. I know, is a little work to do, but I am sure will solve your issue.
modified 10-Jan-20 5:46am.
|
|
|
|
|
Good suggestion, but I cannot even get a simple Yellow World dialog app to debug properly.
Maddening.
Thanks for the suggestions
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
Well, I may have isolated the issue a little closer - the behavior changes depending on what SDK I select - I have multiple embedded CE projects.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
In case someone runs into this in the future - Microsoft has released an update for SP1 for VS2008 Professional that addresses the problem I was having. I really think I applied it one time before, but maybe I got things out of sequence. Anyway, it's KB2483802, link: Download Visual Studio 2008 update for Windows Embedded Compact 7 from Official Microsoft Download Center[^]
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
Sorry to get more and more questions here, but with your support I am solving issues one by one
I got 2 errors:
error C3861: 'srandom': identifier not found
error C3861: 'random': identifier not found
the problem is I don't know how to replace them with Windows versions ... because I didn't found them as defined somewhere ... from your experience, what could be similar windows functions ?
|
|
|
|
|
|
These tho two calls are coming from a Linux code ... and I didn't found documentation about them.
|
|
|
|
|
|
Probably need to use srand() and rand() .
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
That worked. Thank you !!!
|
|
|
|
|
|
I have tried to use srand_s and rand_s , but no one is recognized by my compiler:
error C3861: 'srand_s': identifier not found
error C3861: 'rand_s': identifier not found
|
|
|
|
|
|
I have some code:
sid->identifier_authority
where sid is declared as:
const SID* sid
and the project say that sid is targeting to windows (WinNT.h):
typedef struct _SID {
...
} SID, *PISID;
but I also have (in some header file) inside my project another SID struct declared:
#ifdef SID
typedef struct {
u8 sub_authority_count;
SID_IDENTIFIER_AUTHORITY identifier_authority;
}SID;
#endif
how can I do to sid be as my SID struct, not as _SID windows struct ?
|
|
|
|
|
You need to use a namespace here to remove the ambiguity between types.
Check this thread to see how this can be solved, Why doesn't ANSI C have namespaces? - Stack Overflow.
Quote: how can I do to sid be as my SID struct, not as _SID windows struct ? Are you including both the header files? If they are in separate header files, you can try avoiding including a header file and SID will automatically be of your choice.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Is included only myfile.h, not WinNT.h ... still, the code take _SID because my SID structure is hidden after an #ifdef SID ... the fact is that if I define a SID I got another errors. And for that error see this post: Re: Redirect to my struct - C / C++ / MFC Discussion Boards[^]
modified 8-Jan-20 5:26am.
|
|
|
|
|
Inside myheader.h there is a lot for other structs and defines that is in conflict with those from Windows. SID_IDENTIFIER_AUTHORITY for example ... So, removing or renaming is not an option (I guess). But I am not figure out how to solve this conflict with namespacing ...
|
|
|
|