Skip to content
← Back to Community
How do files work?
Profile icon
h
has Hacker Plan
DynamicSquid

So the code gets the user input and puts it to a file. But if you run the code and input something, will I be able to see your input as well? Or will it like fork the repl or something like that?

Voters
Profile icon
ElijahAnderson1
Profile icon
oignons
Profile icon
Roar123
Profile icon
DynamicSquid
Comments
hotnewtop
Profile icon
xxpertHacker

A potential solution:
Make a new file, name it main, without an extension,
run the Repl, make another file, name it .replit, without an actualy filename, just an extension, inside the .replit file, put: run="main".

I may have just beat the system... but I highly doubt it. Honestly, thinking about this, don't even try, it'll fail.

Profile icon
AmazingMech2418

What happens is that Repl.it creates a randomized file system on the user's end for every time a user views the repl while for the owner, the file system is always in /home/runner. /home/runner is the only file system path that actually will save in a given repl and all other randomly generated paths will disappear on reload or page close. The only way to allow other people to access the /home/runner file system is to use a server and within the server, based on requests from the client, write to files and read files.

Profile icon
xxpertHacker

I found a super easy way to make variadic lambdas (with minimal drawbacks), and am about to make a tutorial on it. Since you seem to be an adequate - good writer, wanna help me with it before I finish it and post it? https://repl.it/@StudentFires/VariardicLambdaTutorial

Profile icon
DynamicSquid

@StudentFires Thanks for the request, but I'm super busy right now with homework :(. Maybe later?

Profile icon
xxpertHacker

@DynamicSquid Honestly I was just about to get off for like, most of today, so want an invite?

Profile icon
xxpertHacker

@DynamicSquid Also, turns out I need someone who has a *modern compiler on their personal computer, as I'm on vacation, so I'm not in my normal coding environment.

By modern, I mean >= C++17

Profile icon
DynamicSquid

@StudentFires K, I'm free for the rest of the day now, so I'll take a look at your project, and yes, I could run it on VS2019

Profile icon
Roar123

Interesting question! From my understanding, someone using your program can write to a text file, but only locally so you (the owner) cannot see their additions. The only one who can permanently write to a text file would be the owner. To avoid this problem, you can create a server with a text file and write sent information to it. With this method, anyone can write permanently to the text file and see other's modifications.

Profile icon
DynamicSquid

@Roar123 Creating a server? Hmm... I've never been down that path before. I'll try learning it!

Profile icon
Roar123

@DynamicSquid Yep, I've only made a flask server with Python but it shouldn't be too hard in other languages

Profile icon
xxpertHacker

@Roar123 Unfortunately, C++ servers aren't the easiest.

Profile icon
DynamicSquid

@StudentFires Are there any tutorials you guys recommend for this?

Profile icon
xxpertHacker

@DynamicSquid For what?

Profile icon
DynamicSquid

@StudentFires Getting started with servers and stuff

Profile icon
xxpertHacker
Profile icon
Roar123
Profile icon
DynamicSquid

@StudentFires Oh cool thanks!

Profile icon
xxpertHacker

@Roar123 It's alright, because It's already been done on Repl.it! Very recently someone posted their server!

I've been thinking about this for weeks.

Profile icon
xxpertHacker

@DynamicSquid Don't thank me, thank #CSharpIsGud!

Profile icon
Highwayman

It should just write it to the file and not fork. Either that or the file just disappears

Profile icon
DynamicSquid

@Highwayman Can you try writing something?

Profile icon
Highwayman
Profile icon
Highwayman

@DynamicSquid it just disappeared

Profile icon
DynamicSquid

@Highwayman Oh, I guess it's only to me then

Profile icon
xxpertHacker

@DynamicSquid This is something that Repl does, it invisibly makes a separate temporary filesystem for each person who views a Repl, I partially wrote about this here: How to access the virtual file system that Repl generates when someone opens a Repl?