MS Visual C++ error while saving a file

Asked By 0 points N/A Posted on -
qa-featured

When saving a file in MS Visual C++ IDE I get an error message:

 “C:fdSdkSamplesEntityReadMe.txt” Cannot save file. The file may be in use by another application.

When I tried to saving the file again it erased all the changes I made and if I don’t save, it deleted the source file which is a bit annoying. I have an Antivirus installed with latest updates; Windows XP SP3 is also up to date.

I do not use this machine for any other purpose, so there is no chance of this application services being in use also.

Please let me know if anyone has a solution.

SHARE
Answered By 0 points N/A #87234

MS Visual C++ error while saving a file

qa-featured

You can use the following steps to create a Windows 32 console project that will convert a file containing "CR/LF" for line termination to "LF":

  1. Use the Windows 32 Console Application AppWizard to create a new empty project named DOS2UNIX.
  2. From the File menu, click New, and then click the Files tab.
  3. Select C/C++ Source File and name the new file DOS2UNIX.cpp.
  4. Paste the following code into DOS2UNIX.cpp:
  5. From the Build menu, click Build DOS2UNIX.exe to generate the .exe file.

You may want to test this .exe file to see if it works properly. To do so, open an existing file in the Visual C++ binary editor by selecting Open under the File menu, selecting DOS2UNIX.ex, setting Open as to Binary, and then clicking Open. For example, if the file contains "HelloCRLFWorld", the binary (hexadecimal) data would look like:

48 65 6C 6C 6F 0D 0A 57 6F 72 6C 64

This is equivalent to:

Hello

World

From a command prompt, run the command dos2unix.exe <file name>. Next, open the file in the Visual C++ binary editor. You will see that the 0x0Ds are removed. As long as you don't edit the file and save it in Visual C++ the 0x0Ds will not appear.

You can use this in conjunction with Visual C++ automation to automate the entire process. A simple Microsoft Visual Basic Script macro can be written to call this tool, but first this tool must be added to the Tools menu as follows:

https://support.microsoft.com/en-us/help/268901/how-to-save-a-file-from-visual-c-in-unix-format

Related Questions