0

I have a directory named /home/Prog where I put my programs. Sometimes, a hidden file with the extension .swp is created in this folder whose contents look like a program that I had had in this folder.

ls -a /home/Prog 
.  ..  1  1.c  2  2.c  3  3.c  4  4.c  .4.c.swp

And cat .4.c.swp results in:

U3210#"! Utp5ad�mehrMehr-hp~mehr/Prog/4.cutf-8
�
�5��������n[Z5"�������g('�
 �
  �
   �
    �
     �
      �
       ~
        }
         [
          #
       �
        �
         �
          �
           �
            �
             }return 0;            else        printf("UNEQUAL\n");                               }                          printf("EQUAL\n");                                           {                       }                                   if(x[i]==y[j])                   {for(i=0;x[i]!='\0';i++)printf("------------------------------------------------\n");//cat two strings without lib;/*********************************************************/                printf("second str after copying: %s\n", y);                 }                y[i]=x[i];                 {for(i=0;x[i]!='\0';i++)/************************************************************/printf("second str has %d cars\n", j);while(y[j]!='\0'){j++;}j=0;/**********************************************************/printf("%d\n",i); {i++;}while(x[i]!='\0')i=0;   */fgets(y,30,stdin);printf("Enter the second string\n");fgets(x,30,stdin);printf("Enter the first string\n");/*int i,j;char y[30]="Mme Rusta";char x[30]="I    do";{int main()#include<string.h>#include<

When I want to create a new file named 4.c with vim, I get the following message:

E325: ATTENTION
Found a swap file by the name ".4.c.swp"
          owned by: mehr   dated: Fri Nov 27 16:52:36 2020
         file name: ~mehr/Prog/4.c
          modified: YES
         user name: mehr   host name: Mehr-hp
        process ID: 1859
While opening file "4.c"
      CANNOT BE FOUND
(1) Another program may be editing the same file.  If this is the
 case,
    be careful not to end up with two different instances of the
same
    file when making changes.  Quit, or continue with caution.
(2) An edit session for this file crashed.
    If this is the case, use ":recover" or "vim -r 4.c"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file ".4.c.swp"
    to avoid this message.

Swap file ".4.c.swp" already exists! [O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:

What is this .swp file and why is it created?

Kevin Bowen
  • 19,615
  • 55
  • 79
  • 83

0 Answers0