hey,
This should be pretty simple:
I need to make a function which returns a person's name from a file
What ends up happening is, I have to return the first letter of the person's name, I can't just goCode:
#include <fstream>
#include <iostream>
#include <cstring>
using namespace std;
char loadName(char def[100])
{
char r[20];
ifstream file(def);
file.getline(r, 20);
return r[0];
}
int main()
{
char name[20];
char def[100] = "c:\\test.txt";
cout << loadName(def);
cin.get();
}
return r;
How would I be able to return a string as opposed to just one char
Thanks in advanced