Added: 3 years ago
From: thenewboston
Views: 48,937
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:
see all

All Comments (162)

Sign In or Sign Up now to post a comment!
  • So, is there a list of the ways you can edit text such as "\n" for new line?

  • which makes it obvious why you would want to close() it.

  • open() doesn't literally open the file. By "open" it means to perform input/output operations on it. So it kind of opens it, but it doesn't display it :3

  • @EMOxCORExAT Is this a joke?

  • @EMOxCORExAT try to right click it and open with and select any windows included text reader program, such as: notepad or worpad, try not to use word or so, cause the text may be different or not showing properly.

  • Took me a couple of tries, but I understand this now :)

  • @EMOxCORExAT This confused me too, but it doesn't open the file, it just makes one, he said in the video that he was opening the file.

  • You should really make a video on binary files.

  • @savanath: I'm using Visual Studio 2010, and I was able to locate the new text file under the name of the project folder I created, but it did not open automatically. Hope this helps.

  • How do I do this using Xcode on a Mac? I tried using "newfile.txt", but it failed because macs don't use .txt files. I tried "newfile.rtf" using Rich Text Editor, which is used to write notes in TextEdit, but it failed as well. I even tried calling one of the text files which I have saved on my computer to test it, but this didn't work either.

  • you need to add abit more to the video so that you can specify where you want to save the text file, regarding its location..because atm im using visual studio and its saving the text file within the project file.

  • ok so i was able to find the text file i created but why doesn't it pop up

  • @gumby30allstar It doesn't open one, it just creates it.

  • great sam keep doing

  • @EMOxCORExAT same, myn saved it in the dev cpp file

  • its fileinception.

  • i follow every step but couldn't find the txt file anywhere

  • @savanath myn saved it in the dev cpp file

  • @savanath search for it in the folder where you saved the cpp

  • @savanath it should be on the root of your project or your source code

  • @savanath it's wherever you put your .cpp file

  • Can I specify the location of the file?

  • Comment removed

  • Comment removed

  • Comment removed

  • Hey,

    why isnt this video on your website?

  • press on the video , now press 5 every half a second ... lolz

  • how do i force the computer to run the program as admin and change dir to create the file in?

  • One word "awesome!"

    

  • is there a way to change the directory that the file will appear in other than just doing system ("cd")

  • I remember when I was like: "What the fuck is he talking about?" and now, I can interpret his code without a second thought, including what's happening behind the scenes.

  • what does this mean:

    C:\users\*****\desktop\happyb~­1.EXE

    the NTVDM CPU has encountered an illegal instruction

    CS:0572 IP:0103 6c 75 64 65 Choose 'close' to terminate the application

    ?

  • \n

    is that for new line like the endl?

  • hey boston, i been working on a program for a while and im having some trouble, i need to create a file by the name thats inputted by the user......how do i do that??

  • umm.....i did the exact same program except i changed the gave the text a bizarre name and it doesent work??

    can any1 help?!

  • @lifetycoon101 same problem

  • also how can you make it only change one thing not all of the file as it will overwrite the previous thing it you just put the thing in you want to change..

  • thank you! really needed this as i needed to help my mate edit a file and he didnt know what to change so i just sent him the .exe and he ran it and it did it for him :D if that made sence

  • Bucky you're a genius!

  • new C++

    Tutorial!!

  • Heheheh this can be used to make viruses....

  • @TheWeirdTechGuy ..not really... you have to enlighten your defenition of a virus.

  • wassupuwssuwh evverybody

  • @RaamAnkka This is used for liken ton of stuff. Saved games and variables, loading maps, and really anything else that you can store in a .txt so you don't have to waste a bunch of memory.

  • So i know this is like not relevant but how could this be use of? could you use it on games maybe for the save file?

  • Excellent tutorials, FAR easier to understand than the others I've been watching. Thanks again.

  • bucky! new c++ tutorials plsss or i am screwed :D

  • Wierd, it makes the file okay, then if i change the text it doesnt get updated. Deleting the txt file, i run the prog again (with different text this time), it creates it, but with the old text inside, not the text i have just changed it too. wth

  • @PICLex re-compile?

  • I done 30tests on 23 tutorials =)

  • one way to find out if you created a new file is to go to start, search, and search for the name of the file you created and if its there, there should also be any text you may have written on to the new txt file aswell! pretty cool!

  • Guys, bucky probably won't be reading these comments. He has almost 1,000 popular videos so he probably gets lots of comments every second.

  • when i do it it shows the command prompt but it doesn't show the file

  • this is magic....

  • I know this tutorial is so old, so I may not get an answer, but this never works for me. I don't know why. Has something changed with C++ in a year that causes this to not work? It's put in exactly, even brings up the command prompt, but never creates any kind of a text file. I basically typed everything in word for word, and no matter how I do it, it never brings up any text file....

  • @Universaldark The same thing was happening to me. However when I ran a search for the file it was found in the same folder as where I had the original file saved (The c++ file)

  • @Universaldark i have the same problem, my command prompt shows up but not the actual text file

  • Compile and Run = The F9 Button. For all of you that want to do this faster.

  • hey dude, i got problem here.

    i am making a math quiz and i got the main stuff to work, but the problem is that when i am writing the points into a file with the name of the person, i want it to add it instead of replacing what's in there already.

    can you help a fellow subscriber? :c

  • sorry for the dead link... here is another one:

    tinypaste[DOT]com/22451d

  • Can't find the file you created? Simply add this code after myfile.close();

    system("notepad yourtextfile.txt");

  • hello folks! i m a c++ newbie but i want a very important (for me) code.i want to run this hexadecimal 10 digit program to a text file.with other words, i need to combine the codes from your video, to my code and create a C code with txt export.can you please doing that for me/? sorry for bad englsh.here is the link

    mediafire[DOT]com/?ydpasf8d2kx­8lld

  • eyyy, anyone knows how to use the app option to append text instead of overwriting the previous text?? I have tried but my text turns into []

  • Is it supposed to open the file, or just create it?

  • i have one question: what does the "using namespace std" do? i do some c++ programming at school, but i've never used or heard about this; thanks in advance, and thanks for sharing your c++ knowledge with us ;)

  • wow this actually works! it will appear where you saved your application in the first place. great vids thx.

  • Shit just got real

  • @XAutomatedOwnerX

    haha rofl

  • thank you so much this was really helpful!!

  • We are including a F*cking Stream! (fstream)

  • The file is gonna be created in the Dev-Cpp folder. Most likely in " C:/Dev-Cpp "

  • Why dont you use using namespace std;

  • More C++ tutorials please?.

    By the way how can I continue to write to the file without the previous information getting overwritten?

  • @light0913 ... you do this: (following the names that bucky just used btw).....

    myfile.open(newfile.txt, ios::app)

  • thanks, i'm going to try it

  • Doesn't work.

    I have XP, and no icon showed up

    I tried over-writing a previous file, no change was made.

  • @ElPeester Can you show me or him the exact code that you wrote ? Cuz its pretty hard to tell you what you have done wrong without it. Just copy and paste it into here.

  • @ElPeester The file gets created in the workspace folder that the .cpp file is in. buckys was probably on the desktop

  • @coolzidedown True, found it in the workspace folder thanks.

  • @coolzidedown wat if the cpp file is not there?

  • Lol you could probably do some terrible things to friends with this if you use it that way xD *deletes system files* oh shi-

  • Hello, iam not new to c++ but i have a question, what if you dont want to erase the previous "version" of the file but want to continue on the bottom ?

    Thanks in advance

    tHaH4x0r

  • I'm using windows xp but there is no file that shows up on my desktop

  • Great videoo !!

  • For those of you using Windows 7, the file won't be created on the desktop. It'll be created wherever the actual C++ program we've been working with is saved, most likely in C:\Dev-Cpp.

  • @CtrlCreate thanks

  • This doesn't work in windows 7 People...

  • @FreshAnimeEpisodes I'd imagine it would save it to the same folder as the source code.

  • its going to be hard remembering all the libraries.

  • When running the program run as admin otherwise uac wont let u create the file.

  • This doesnt work on Windows 7... :d

  • @Loosner202

    I thought so too, until I discovered it's actually made in the same folder as you saved your program (which in my case was not the desktop). Also if that text file is still missing, try to run your program as administrator and now it should work.

  • @eeemiel You are right , thanks ! :D

  • thanks man, very clear explanation that i couldn't find that simple on internet. Your best tut, keep up the good work

  • Haha I forced my friends computer to create thousands of these!

  • you are great man thnx

  • Can anyone help me? I don't get any errors but it wont work. Also i posted on some forums but they also don't know what the prob is :\

  • WoW GreaT ur Tutorial is very easy to understand. Thnx

  • I love you bucky. Great work......

  • strange, i don't get any errors, but it wont work

  • how do you append to the same file instead of rewriting it

  • This looks like it be very helpful, yet i havent read anything on it. Thanks for the tutorial.

  • great tutorial man one of the few concepts of c++ i still have to learn to get the basics down... As far as system("pause"); you're better of using cin.get(); to make a program platform portable...

    as for below with using namespace std most classes that ive seen using std by people a lot better then me uses std::cout<< etxc, to avoid the computer getting cofused and just in case theres is any name conflict

  • @shortbuttall95 cin.get(); works, I honestly prefer #include "conio.h" and using _getch();

    no comment on namespace std.

  • how can you amend the file vs. replacement.

  • using namespace std can go any where best practice to put it at the start.

    When you come to classes you won't want to use using namespace std command but use std::cin.get

    I came on this page by mistake!

  • @ryancfcsas Why do you think you wont use "using namespace std;" in classes?

    Its simply use to tell the compiler which namespace we are checking for our object, to avoid ambiguity.

    i didnt put that very well but its basically what it does.

  • The most common thing bucky says is

    "Gonna wanna do"

    XD

  • lol but thats one of the reasons we love him

  • i noticed the command

    using namespace std;

    moved places from this tutorial to the last...does it really matter where that code is?

  • hmm well it does matter... but i cant exactly explain it just look up a video on namespaces

    id give u one but i dont wana advertise other tutorials

  • If its inside the funktion you have to write it in all the funktions and if its outside then it will be global and there will be no need to write it in all funktions....

    atleast i think this =/

  • Great tutorial.

    How can i choose what location on my computer the file should be open from?

  • I like this tutorial, however I also had a small problem finding the file. But as a note you should look in your file where ever your programs are being saved to. Thanks Bucky...You rock!!! \0/

  • and duck tails you pwn thx i wen t crazy your aswome

  • how do i get to your website the link brings me to a video wasup with that i want to get that code you said i can get

  • If you are not able to see the txt file please check inside the folder where you are saving your c++ programs. For example in my case I save all my programs on c drive on a folder called cplus. In this case I open the c drive and just check in that folder. so it depends where u save ur programs.. desktop, my documents etc

  • thanks man you realy saved my butt i was going crazy i though my system was error or somthing then i read your note and you helped me you rock thx

  • hello everyone. i cant get it to work. i nid ur help i cant get it to work on my pc. no file is been created. i have followed the steps all ova and ova, but it aint working. thanks.

  • is the program on your desktop?

  • you used \n for a new line for the first time in all of the tutorials lol

  • i can't frekin get it to work nothing is appearing on my desktop

  • check your documents

  • Please take a look where your folder containing Dev-C++ is located. It should be there

  • Thank you.

  • I had to save as new.cpp in the desktop location for it to work. U will get 3 new desktop icons if u save it this way.

    1 of them will be the txt file.

    and the other 2 will be the dev project and the cmd prompt result.

  • hey im runnin xp and nothing happened he;p anyone

  • whats a memory leak?

  • When you allocate something but don't deallocate it. Use CloseHandle() for your handles and delete/[] if you use new for a variable.

  • thank you ^.^

  • hello sir

    are you going to post more C++ tutorials?

    Please do

    Thank you

  • when will the next c++ tutorial come up?

  • ...No. API (WriteFile, ReadFile, OpenFile, etc) > fstream. Bad coding habits. And what's the point of system("pause"), you are just writing something, why let it stop? If you are going to do something, just use std::cin.sync(); and std::cin.ignore(); if you are already using iostream. But if you still want to pause with API, just make an empty Win32 app and display a messagebox if it returns sucessful

  • Actually, if it was criticism, I would have just blantantly said how "bad" it was. (Though it completely wasn't) I gave better methods such as using std::cin.sync(); and std::cin.ignore(); So I think your mindless post has reserved the right to be used as toilet paper.

  • Comment removed

  • Fag.

  • and my name is Nicola,nice to meeet you

  • he uses namespace. wouldnt it be easier to just not include the std: part and just do the cin.sync();

    dont get angry at me in new to this juts wondering

  • nice

  • I say from my experience this and making structures are some of the most useful things in C++ Thnx Bucky!

  • Thanks much,

    Your tutorials are extraordinarily helpful for me.

    I am trying to navigate my way through my self taught program to learn about computers and coding- your tutorials of C++ and How to Build a Computer are greatly appreciated.

    I am indebted for your efforts,

    Kevin Walsh

    Chicago Peak Oil

  • yes i hope you do a tutorial that covers all the main libraries which will sometimes need to be included in c++ programming. thanks tutorials how to how do i? you are awesome thenewboston. giveaway.

  • great how to tutorial on how to input and output files, well the prelude.. writing on files! learning fstream syntax...

  • Does this method only work for creating text files?

  • nice thx, is this what is used to make programs like games and stuff? cuz like is it only txt i can use ? or like actual programs..

  • C++ is the language of computer, it's used to create programs, also complicated

  • yes you can create games with it.

    but there are other programming languages that can too.

  • first view, but no computer! :(

  • dont worry ill be adding another contest soon, but there are 2 other contest going on now!

  • come on man upload new c++ turtorials!!!!!

Loading...
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more