Niloy007

File Class 01

Jul 15th, 2020
132
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. // File Declareation
  4. // FILE FilePointer
  5.  
  6.  
  7. // int main() {
  8. //  FILE *file;
  9. //  file = fopen("input.txt", "w");
  10. //  char arr[20];
  11. //  gets(arr);
  12.  
  13. //  if(file == NULL) {
  14. //      printf("File does not exist\n");
  15. //  } else {
  16. //      printf("File has been created\n");
  17. //      fprintf(file, "%s", arr);
  18.  
  19. //      fclose(file);   // closing the file
  20. //  }
  21. // }
  22.  
  23.  
  24.  
  25. // int main() {
  26. //  char a = 'A';
  27. //  printf("%d\n", a);
  28. // }
  29.  
  30.  
  31. // int main() {
  32. //  int a = 15, b = 2;
  33. //  double result = a / (double) b;
  34. //  printf("%d\n", a);
  35. //  printf("%.2lf\n", result);
  36. // }
  37.  
  38. /*
  39.     Creating a new File
  40.     fopen("file path", file_mode);
  41.  
  42.     opening an existing file
  43.     fopen("file path", file_mode);
  44.  
  45.     closing a file            
  46.     fclose(file_pointer);
  47.  
  48.     Reading from and writing information to a file
  49.  
  50.         To write something in a file ->
  51.         fputs(string, file)
  52.         fprintf(file_pointer, formate_specifier, variable_Name)
  53.  
  54.         To read something in a file ->
  55.         fgets(variable, size, file_pointer)
  56.         fscanf(file_pointer, formate_specifier, variable_name) ---> %[^\n]
  57.  
  58. */
  59.  
  60.  
  61.  
  62.  
  63. /* Projects
  64. -----------
  65.  
  66. ---> Structure
  67.     --> insertion
  68.     --> delete (optinal)
  69.     --> update
  70.     --> query
  71. ---> File   (optional)
  72.  
  73.  
  74. Project submission: Mid exam sesh houar porer 5 diner
  75.  
  76. Project Title
  77.  
  78. */
RAW Paste Data