ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!
Home
Upgrade
Credits
Help
Search
Awards
Achievements
 3358

Delete.

by NoNameV2345 - 01-04-2019 - 06:28 PM
#1
Delete.
This account is currently banned
Ban reason: Leeching and Spamming is not allowed, please read the forum Rules upon your return.
Reply
#2
I have no idea what you're attempting to ask. Just tell me exactly what you want done and I can help you.
Reply
#3
(02-04-2019 - 12:42 AM)IcyJake Wrote: I have no idea what you're attempting to ask. Just tell me exactly what you want done and I can help you.

I'm trying to read the content inside the file (in this case, .txt) in list effect. So that yes have the possibility to, select the text inserted inside the file.
Inside the txt file I wrote:

Code:
Hi
Guys
:)

(exactly like thats)
I would like to reads the content inside the file as a list, which in this case are simple texts.
This account is currently banned
Ban reason: Leeching and Spamming is not allowed, please read the forum Rules upon your return.
Reply
#4
[Image: RJ3aE4M.png]

You mean like that? If that's what you want, then here:

Code:
#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>

using namespace std;

int main()
{
   SetConsoleTitleA("Read a text file line-by-line");

   string theLines; // Read line
   ifstream yourFile("yourFile.txt");

   if (yourFile.is_open())
   {
       while (yourFile.good())
       {
        getline(yourFile, theLines);
           cout << theLines << endl;
       }

       yourFile.close();
   }

   else
   {
       cout << "An error occured while trying to open the file!";
   }

   cout << "" << endl; // Not important (just for organization in the console)

   system("pause"); // Keeps the console open

   return 0;
}
Reply
#5
(02-04-2019 - 02:21 AM)IcyJake Wrote: [Image: RJ3aE4M.png]

You mean like that? If that's what you want, then here:

Code:
#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>

using namespace std;

int main()
{
   SetConsoleTitleA("Read a text file line-by-line");

   string theLines; // Read line
   ifstream yourFile("yourFile.txt");

   if (yourFile.is_open())
   {
       while (yourFile.good())
       {
        getline(yourFile, theLines);
           cout << theLines << endl;
       }

       yourFile.close();
   }

   else
   {
       cout << "An error occured while trying to open the file!";
   }

   cout << "" << endl; // Not important (just for organization in the console)

   system("pause"); // Keeps the console open

   return 0;
}

yeah, but i need for c...
This account is currently banned
Ban reason: Leeching and Spamming is not allowed, please read the forum Rules upon your return.
Reply
#6
(02-04-2019 - 10:22 AM)NoNameV2345 Wrote:
(02-04-2019 - 02:21 AM)IcyJake Wrote: [Image: RJ3aE4M.png]

You mean like that? If that's what you want, then here:

Code:
#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>

using namespace std;

int main()
{
   SetConsoleTitleA("Read a text file line-by-line");

   string theLines; // Read line
   ifstream yourFile("yourFile.txt");

   if (yourFile.is_open())
   {
       while (yourFile.good())
       {
        getline(yourFile, theLines);
           cout << theLines << endl;
       }

       yourFile.close();
   }

   else
   {
       cout << "An error occured while trying to open the file!";
   }

   cout << "" << endl; // Not important (just for organization in the console)

   system("pause"); // Keeps the console open

   return 0;
}

yeah, but i need for c...

I mean, can't you convert that to C by yourself? If you can't then I'll help you, but you should be able to.
Reply
#7
(02-04-2019 - 10:41 PM)IcyJake Wrote:
(02-04-2019 - 10:22 AM)NoNameV2345 Wrote:
(02-04-2019 - 02:21 AM)IcyJake Wrote: [Image: RJ3aE4M.png]

You mean like that? If that's what you want, then here:

Code:
#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>

using namespace std;

int main()
{
   SetConsoleTitleA("Read a text file line-by-line");

   string theLines; // Read line
   ifstream yourFile("yourFile.txt");

   if (yourFile.is_open())
   {
       while (yourFile.good())
       {
        getline(yourFile, theLines);
           cout << theLines << endl;
       }

       yourFile.close();
   }

   else
   {
       cout << "An error occured while trying to open the file!";
   }

   cout << "" << endl; // Not important (just for organization in the console)

   system("pause"); // Keeps the console open

   return 0;
}

yeah, but i need for c...

I mean, can't you convert that to C by yourself? If you can't then I'll help you, but you should be able to.

Im tried, but I can't convert it. : /
This account is currently banned
Ban reason: Leeching and Spamming is not allowed, please read the forum Rules upon your return.
Reply
#8
(02-05-2019 - 12:16 AM)NoNameV2345 Wrote:
(02-04-2019 - 10:41 PM)IcyJake Wrote:
(02-04-2019 - 10:22 AM)NoNameV2345 Wrote:
(02-04-2019 - 02:21 AM)IcyJake Wrote: [Image: RJ3aE4M.png]

You mean like that? If that's what you want, then here:

Code:
#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>

using namespace std;

int main()
{
   SetConsoleTitleA("Read a text file line-by-line");

   string theLines; // Read line
   ifstream yourFile("yourFile.txt");

   if (yourFile.is_open())
   {
       while (yourFile.good())
       {
        getline(yourFile, theLines);
           cout << theLines << endl;
       }

       yourFile.close();
   }

   else
   {
       cout << "An error occured while trying to open the file!";
   }

   cout << "" << endl; // Not important (just for organization in the console)

   system("pause"); // Keeps the console open

   return 0;
}

yeah, but i need for c...

I mean, can't you convert that to C by yourself? If you can't then I'll help you, but you should be able to.

Im tried, but I can't convert it. : /

Do you have Discord or something? I'm asking because I wanna try to actually help you instead of pretty much just spoonfeeding you, lol.
Reply
#9
(02-05-2019 - 01:03 AM)IcyJake Wrote:
(02-05-2019 - 12:16 AM)NoNameV2345 Wrote:
(02-04-2019 - 10:41 PM)IcyJake Wrote:
(02-04-2019 - 10:22 AM)NoNameV2345 Wrote:
(02-04-2019 - 02:21 AM)IcyJake Wrote: [Image: RJ3aE4M.png]

You mean like that? If that's what you want, then here:

Code:
#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>

using namespace std;

int main()
{
   SetConsoleTitleA("Read a text file line-by-line");

   string theLines; // Read line
   ifstream yourFile("yourFile.txt");

   if (yourFile.is_open())
   {
       while (yourFile.good())
       {
        getline(yourFile, theLines);
           cout << theLines << endl;
       }

       yourFile.close();
   }

   else
   {
       cout << "An error occured while trying to open the file!";
   }

   cout << "" << endl; // Not important (just for organization in the console)

   system("pause"); // Keeps the console open

   return 0;
}

yeah, but i need for c...

I mean, can't you convert that to C by yourself? If you can't then I'll help you, but you should be able to.

Im tried, but I can't convert it. : /

Do you have Discord or something? I'm asking because I wanna try to actually help you instead of pretty much just spoonfeeding you, lol.
This account is currently banned
Ban reason: Leeching and Spamming is not allowed, please read the forum Rules upon your return.
Reply

Users browsing: 3 Guest(s)