The first approach won't work because "Map/" is a pointer (const char *) - it's a data type that gives a memory location where the string "Map/" is stored (same for ".jrpmap"). When you add i to it, what you're actually doing is changing the memory location it stores - which will result in a memory leak.