Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- infile.open (fileName.c_str());
- string line = "";
- getline(myFile,line,'#'); // Puts the first line of myFile and puts it into a string
- string nextDouble="";
- int curArraySpot=0;
- while(!line.empty()
- {
- if(line[0]==" ")
- {
- double newDub=nextDouble;
- yourArray[curArraySpot]=newDub; // change nextDouble from string to double and place it in array
- curArraySpot++;
- nextDouble="";
- }
- else
- {
- nextDouble=nextDouble+line[0]; // add the next char from line to your new string
- line=line.substring(1); // Removes the first char from line, shortening it by 1
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement