Does anyone know how much .txt files can be saved as a file on replit?

Question:
I was coding on C++, just making a simple program to save a number of prime numbers in a file, and used a txt file to store the numbers that I wanted. It seemed to go well until the numbers just stopped at 99719. The file stopped right at col 65549, ln 1, and did not cut off, as the file just stopped writing right at the number, even though I had <<", "; after the to_string(). I will put the C++ code just in case.

main.cpp

#include<bits/stdc++.h>
using namespace std;
int main() {
vector sosuu;
long long x=1;
bool ifs=true;
ofstream txtfile;
long long loop=1000;
txtfile.open(“prime.txt”);
cout<<“how many prime numbers do you want?\n”;
cin>>loop;
try{
while(true){
ifs=true;
x++;
for (long long i=0;i<sosuu.size();i++){
if(x%sosuu[i]==0){
ifs=false;
}
}
if(ifs){
sosuu.push_back(x);
cout<<to_string(x)<<endl;
txtfile<<to_string(x)<<", ";
}
if(sosuu.size()==loop){break;}
}
cout<<“process completed. the requested amount of individual prime numbers are stored in "prime.txt".”<<endl;
exit(0);

the variables are slightly based of Japanese. Sorry if it’s hard to see.

There are storage limits based on your plan on Replit. The free plan gives you 500 MB of storage, while the hacker plan offers 10x that.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.