stringの関数c_str()と、data()の違いが分かりません。
↓こんなことしてみたんですけど、なにがなんだか。
#include <string>
#include <stdio.h>
#include <iostream>
using namespace std;

int main()
{
string str = "ABC";
cout << str.c_str() << "\n";
cout << str.data() << "\n";

for ( int i = 0 ; (str.c_str())[i] != '\0' ; i++ )
{
cout << (str.c_str())[i] << "\n";
}

for ( int i = 0 ; (str.data())[i] != '\0' ; i++ )
{
cout << (str.data())[i] << "\n";
}
}