Currently my programme takes a string as an input which I access using argc and argv
then I use
FILE *fp, *input = stdin; fp = fopen("input.xml","w+b"); while(fgets(mystring,100,input) != NULL) { fputs(mystring,fp); } fclose(fp); I did this part only to create a file input.xml which I then supply to
ifstream in("input.xml"); string s((std::istreambuf_iterator<char>(in)), std::istreambuf_iterator<char>()); to get s as a string(basic string). Is there a way to feed my input directly to ifstream? (i.e feeding a string to ifstream).
ifstreamis designed to read a file. You can usestd::stringstreamif you want to feed astd::stringas anistream.std::istringstreamstd::string?argcandargv, which seem to make no sense.