Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

Read form text document

$
0
0
ifstream myfile("Modifyed_sine.txt");
	if (myfile.is_open())
	{
		//ifstream ifs("modifiedtrapeziod.txt");
		while (getline(myfile, line)) {
			string total = line;
			std::size_t found = total.find(' ');
			total = total.substr(found + 1);
			found = total.find(' ');
			lift[loop] = total.substr(0, found);
			total = total.substr(found + 1);
			found = total.find(' ');
			velocity[loop] = total.substr(0, found);
			total = total.substr(found + 1);
			found = total.find(' ');
			acceleration[loop] = total.substr(0, found);
			total = total.substr(found + 1);
			found = total.find(' ');
			string number = total.substr(0, found + 1);
			int final = atoi(number.c_str());
			total = total.substr(found + 1);
			found = total.find(' ');
			lift[final] = total.substr(0, found);;
			total = total.substr(found + 1);
			found = total.find(' ');
			velocity[final] = total.substr(0, found);
			total = total.substr(found + 1);
			found = total.find(' ');
			acceleration[final] = total.substr(0, found);
			total = total.substr(found + 1);
			found = total.find(' ');
			number = total.substr(0, found + 1);
			final = atoi(number.c_str());
			total = total.substr(found + 1);
			found = total.find(' ');
			lift[final] = total.substr(0, found);
			total = total.substr(found + 1);
			found = total.find(' ');
			velocity[final] = total.substr(0, found);
			total = total.substr(found + 1);
			found = total.find(' ');
			acceleration[final] = total.substr(0, found);
			total = total.substr(found + 1);
			found = total.find(' ');
			number = total.substr(0, found + 1);
			final = atoi(number.c_str());
			total = total.substr(found + 1);
			found = total.find(' ');
			if (final == 120) {
				lift[final] = total;
				velocity[final] = "0";
				acceleration[final] = "0";
			}
			else {
				lift[final] = total.substr(0, found);
				total = total.substr(found + 1);
				found = total.find(' ');
				velocity[final] = total.substr(0, found);
				total = total.substr(found + 1);
				found = total.find(' ');
				acceleration[final] = total.substr(0, found);
			}
			total = "";
			line = "";
			loop++;
		}
		myfile.close();
	}

The code opens text as you can see, and import text form text file on disk.

But I want that integrate in to the clr Project and read them from there, instead from disk.

Any have a good idea what need to be changed to do that?

thank you


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>