# DEFINE _ crtdbg_map_alloc # include <stdlib. h> # include <crtdbg. h> # include <stdio. h> # include <string. h> # define path "input.txt" int main () {file * FP; int I, j; char * STR [1024]; I = 0; FP = fopen (path, "R"); If (FP = NULL) {/* Code */printf ("error \ n");} else {STR [I] = (char *) malloc (sizeof (char) * 1024); While (fgets (STR [I], 100, FP )! = NULL) {I ++; STR [I] = (char *) malloc (sizeof (char) * 1024);} For (j = 0; j <I; j ++) {printf ("% s", STR [J]) ;}for (j = 0; j <= I; j ++) {free (STR [J]);} fclose (FP);} _ crtdumpmemoryleaks (); Return 0 ;}
------------------------------------------------------------------
# Include <iostream> using namespace STD; # include <assert. h> # ifdef _ debug # define debug_clientblock new (_ client_block, _ file __, _ line __) # else # define debug_clientblock # endif # DEFINE _ crtdbg_map_alloc # include <crtdbg. h> # ifdef _ debug # define new debug_clientblock # endifvoid exit () {int I = _ crtdumpmemoryleaks (); Assert (I = 0);} int main () {atexit (exit); int * P = new int; return 0 ;}