How to push into values into a stack from a text file

I am trying to teach myself C++ with some programming assignments. Trying to learn using stacks but I am unsure how to push values from a txt file into a stack.

Let' say I have the following text file:

16 24 25 3 20 18 7 17 4 15 13 22 2 12 10 5 8 1 11 21 19 6 23 9 14

How would I use ifstream,and argv from the command line to push the values into a stack?

Did research and using this as help, but it may not be relevant:

How to push data of different data types into a vector by reading from a file?


Here is something to get you started.

stack<int> data;
    ifstream file("file.txt");
    int i;
    while (file >> i)

Need Your Help

Threading.Timer with Autoreset or Single Thread?

c# multithreading timer

I want to create a class that reads SMS messages from a GSM device.

Two unstable queries performance

mysql join relational-database relationship

I'm really confused about this two queries, they are have unstable query speed. Here is my two table scheme;

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.