>>string ****Nipples;
OMG what in hell are you trying to do here??? If you are trying to code an array of string's then its string Nipples[4];
But the reading part should look like this: (I hope you change the variable names before turning in the assignment because your teacher may not be that humerious.)
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
using namespace std;
int main()
{
ifstream RapidShit ("C:\\Rapid.txt");
vector<string> Nipples; // an array of strings
string line; // one line in the file
if(RapidShit.is_open())
{
while (getline(RapidShit, line) )
{
Nipples.push_back(line); // add to the array
}
// now you have the entire file in memory. Search each line
// for the desired entry.
}
cin.get();
return 0;
}
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
>>string ****Nipples;
Forget about doing that! It won't work. That is not four strings, but a pointer to pointer to pointer to pointer of type string. Amazingly it compiles without error, but that doesn't mean it will work, which it won't.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
>>Probably far too long but it works.
Only because you were very lucky in your tests.
>>getline(RapidShit, ****Nipples);
What does that pointer Nipples point to? Nowhere -- just some random number because Nipples was never initialized.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
lol im not lucky it works 100% :P
Then what's the point of this thread, anymore?
MosaicFuneral
Posting Virtuoso
1,691 posts since Nov 2008
Reputation Points: 888
Solved Threads: 116
Amazingly it compiles without error
Amazingly, this compiles without error (for me) :icon_eek:
So I'm not too surprised that his compiled x)
char ********************************************************************************
********************************************************************************
********************************************************************************
********************************************************************************
********************************************************************************
********************************************************************************
********************************************************************************
********************************************************************************
********************************************************************************
********************************************************************************
******************************************************************************** a;
William Hemsworth
Posting Virtuoso
1,591 posts since Mar 2008
Reputation Points: 1,429
Solved Threads: 129
AFAIK there is no limit to the number of stars.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343