Lanka Developers Community

    Lanka Developers

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Shop

    C++ to txt file update

    Programming
    c++ sinhala programming help
    4
    8
    1211
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • KrissSachintha
      KrissSachintha last edited by

      දන්න කෙනෙක් කියන්න c++ වලින් කොහොමද txt file එකක තියන data update අරන්න් code එක ලියන්නේ කියලා

      Eg : username and password txt එක්ක තිබොත් c++ හරහා password එක update කරන්න

      1 Reply Last reply Reply Quote 0
      • Nubelle
        Nubelle Web Development last edited by

        meka balana https://www.daniweb.com/programming/software-development/threads/93584/how-to-update-data-in-a-text-file

        KrissSachintha 1 Reply Last reply Reply Quote 0
        • KrissSachintha
          KrissSachintha @Nubelle last edited by KrissSachintha

          @Malith not the answer i was hoping

          1 Reply Last reply Reply Quote 0
          • ciaompe
            ciaompe last edited by

            .txt use karanna epa .dat use karnana oyata lesiyen karnana puluwan oya wade.

            1 Reply Last reply Reply Quote 1
            • ciaompe
              ciaompe last edited by ciaompe

              me thiyenne .txt eken use karana widiya.

              #include <iostream>
              #include <fstream>
              #include <conio.h>
              #include <string>
              
              using namespace std;
              
              class User {
              
              public:
              	string username;
              	string password;
              
              	void userRegister()
              	{
              		ofstream usersFile ("userData.txt");
              		if (	!usersFile.is_open())
              		{
              			usersFile.open("userData.txt");
              		}
              	        usersFile << username << " " << password << endl;
              	        usersFile.close();
              	}
              
              };
              
              int main() {
              	
              	User user1;
              	
              	cout << "Welcome!\n-------------------------------\n\nPlease register.\nEnter a new username:\n";
              	cin >> user1.username;
              
              	cout << "\nPlease enter a new password:\n";
              	cin >> user1.password;
              
              	user1.userRegister();
              
              	getch();
              }
              
              KrissSachintha 1 Reply Last reply Reply Quote 1
              • KrissSachintha
                KrissSachintha @ciaompe last edited by

                @ciaompe machan assigment ekata, txt file ekin thibanm thama hari,

                root 1 Reply Last reply Reply Quote 0
                • root
                  root Linux Help @KrissSachintha last edited by root

                  @ChrisSachintha
                  Oya udin dala thiyenne machan code eka

                  1 Reply Last reply Reply Quote 0
                  • KrissSachintha
                    KrissSachintha last edited by

                    guys mata one wade una, thanks for every ones's help eth ogola hamoma duna link wala thibe for loop ekak athule code karala, ee nisa api loop eka run wene dene ganata thami run une, eka aula thami hithana login,txt eka records 100 thiyanwa eth api loop ekata dune 10 bn eka wada nane, ow ow dan ogola kiyai 100 loop ekata dunam harine kiyala, na eka waradi mokda mage program eka thiyanwa aluthin record txt fielata add karana ethaktoa 100 dala bane, anway thanks man code eka manma hadagatha, ogolatantath awasha wei kiyala hithuna nisa denam code ekata

                    https://helageek.blogspot.com/2019/08/c-txt-file-data-update-code.html

                    1 Reply Last reply Reply Quote 0
                    • 1 / 1
                    • First post
                      Last post

                    0
                    Online

                    3.7k
                    Users

                    1.3k
                    Topics

                    5.3k
                    Posts

                    • Privacy
                    • Terms & Conditions
                    • Donate

                    © Copyrights and All right reserved Lanka Developers Community

                    Powered by Axis Technologies (PVT) Ltd

                    Made with in Sri Lanka

                    | |