Click here to Skip to main content
15,070,613 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
let me explain, some years ago i had one project in university by some bad teacher, i mean he didnt even explain what was java and he gave us that project on our first day, it was so painful to see just one guy did it and it was because that guy was teacher favorite, he had a lot of diplomas about programming and everything...props for him but i always had the question...how do you do that?

the project was this "simple"...you had a .txt file and you have to open it with your program...which has to say on the terminal "the file ...txt is open" and then you can search-like sql, you do querys and the program would tell you how many things where in the file, create new tables, eliminate them, modify, everything.

anyone has a remote idea how you do that?

What I have tried:

i tried and failed big time before and never thought about it until now.
Posted
Updated 2-Jun-21 21:21pm

Basically, don't.
A text-based file is a really bad idea: it doesn't have any structure and it's intended to store human-readable data, and what you are trying to create is anything but that!

You are talking about creating a whole database engine, and they are very, very complex - particularly if you want to do "SQL" searches and queries.

Frankly, I don't believe for a minute that anyone gave that as a project on the first day of any development language class - the students would have no idea even what database tables were, and being able to compile and (just about) run a Java app to say "Hello World!" is no basis for creating formatted file I/O based apps.
   
Comments
vonhacker 18-Jun-21 0:51am
   
Believe me when I say that d*ckhead of my professor did that... He made a .txt file called "tronitos" with some data and you have to do basically read and create a file with all the query... I'm still not sure how you do something like that. And looking for your answer is way more complicated than it should have been for a beginner. (really I didn't knew how to do a simple "hello world" on Java)
Quote:
anyone has a remote idea how you do that?
Well, as OriginalGriff says, it is not a good idea for an actual program. However, if you want to do it as an exercise in learning Java then it could be interesting. I would start at The Java™ Tutorials[^] which will lead you through all the steps necessary.
   
Comments
vonhacker 18-Jun-21 0:53am
   
I know is not a good idea, but it was the professor gave us as project for the semester
Richard MacCutchan 18-Jun-21 3:28am
   
So do what I suggested and study the tutorials. You will not learn a complete language by posting questions here.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900