Search:

Type: Posts; User: twilight

Search: Search took 0.01 seconds.

  1. thanks guys :-) I will try that tomorrow, today I...

    thanks guys :-) I will try that tomorrow, today I am out of here :-)

    you are great :-)
  2. hmm... I have no clue how to do that. Also, I...

    hmm... I have no clue how to do that.

    Also, I would have to check in every function, if the object is already created or not, if not: create it, if yes, work with it. But right now, I have no idea...
  3. well, nope, I would not flinch :-D but what I...

    well, nope, I would not flinch :-D but what I meant is different, somewhat.

    I mean, sure I can pass objects, variabels and stuff, but when I open a file in one function, at the end the file is...
  4. hmm... ok. I have thought of that, too. But could...

    hmm... ok. I have thought of that, too. But could not figure out how.

    istream is just for inputing files from harddrive to my program, right? ofstream is just for outputting files from program to...
  5. well, I am using the same filename the user typed...

    well, I am using the same filename the user typed in before and I saved in a string, named filename.

    So, the filename should be the same.

    Just for the sake of argument here: Am I doing...
  6. I just realized I never closed the file in my...

    I just realized I never closed the file in my read_file() function. I now added the close-method, but the error remains.

    In my whole appendto_file()-Method I am doing 2 things:
    - I am opening and...
  7. I just thought a further check would be nice to...

    I just thought a further check would be nice to see if the file-opening for the fstream worked out, so I changed the snippet from:


    std::cout<<"Please enter the text you want to append: \n";...
  8. oh, tanks, that clears that issue :-) what...

    oh, tanks, that clears that issue :-)

    what about my code-snippet from the most recent post? Any hint you have for me there?
  9. oh, man. I had that once before :-( thx for the...

    oh, man. I had that once before :-( thx for the hint again!!

    now it works. At least, it compiles. my appendto_file() function now asks for the filename, prints an error if it can't be opened,...
  10. thx, the error is now gone. just for my...

    thx, the error is now gone.

    just for my understanding: isfile[0] looks like I am accessing the first char of an array of chars, but isfile is a string, or more precisely: an object. What exactly...
  11. thx, I changed ios::app into std::ios::app. ...

    thx, I changed ios::app into std::ios::app.

    Ok, so check a string against a character is not possible. Makes sense I guess. :-D But what when I use the string.c_str()-function. So to say:

    ...
  12. So, after I got a little confused with how the...

    So, after I got a little confused with how the tutorial on this page explains things, I found myself another tutorial, that suits me "needs" way better i.e. describes things how I need to hear them...
  13. thanks, that did the trick :-) the tutorial...

    thanks, that did the trick :-)

    the tutorial used the >> operator with a char text[] and it worked with more than one word, so I thought I could use it the same way with the ifstream-struct, but...
  14. so, I just had some time and thought "hey, let's...

    so, I just had some time and thought "hey, let's begin with the second method (i.e. read_file();)

    I made some mistakes, now it works that it does recognize when there is no file that could be...
  15. :-) thx again!

    :-) thx again!
  16. yes, I am sure that is the code that got...

    yes, I am sure that is the code that got compiled. :-)

    So my strings are in fact objects, right? And the c_str(); method from my file gives back a classic c-string?!

    Changed the code...
  17. thx Spidey, that really helped me to...

    thx Spidey,

    that really helped me to understand what goes where. What you first said I already knew, but maybe I said it wrong, but the rest was something I definitly needed :-)

    And as Elysia...
  18. thanks. so my guess was right: I prototype the...

    thanks.

    so my guess was right: I prototype the function in the header, and then I use it in my main as I whish, but having it actually defined in another .cpp-file

    I just googled include...
  19. ok everybody, thanks a lot for your quick...

    ok everybody, thanks a lot for your quick answers.

    Putting the code from the .h file under the "using" did the trick. Thanks!!

    As I said: I am going by the tutorial and I am at lesson 10. And...
  20. xy was not declared in this scope: compiler error!

    Hey everybody,

    I finished lesson 10 today, fileio, and thought "Hey, let's combine all I have learned before.

    So I programmed a simple menu with switchcase, and thought I would give the user...
  21. Replies
    8
    Views
    1,634

    yeah, the code should be ok. It is the one right...

    yeah, the code should be ok. It is the one right from the tutorial :-D

    but thx for your reply! As I said before: it is alright now! Using g++ instead of gcc it worked.
  22. Replies
    8
    Views
    1,634

    I feel kind of stupid now because I usualy know...

    I feel kind of stupid now because I usualy know stuff like that.

    Used to use Gentoo-Linux for years and compiling sources and whatnot... :-D

    thx, that was it.
  23. Replies
    8
    Views
    1,634

    strange errors when compiling.

    Hi folks,

    I am new to this forum. Am 25 years old, I am working in the computer-area for about 9 years now (if you count my aprenticeship) but never got the hang of programming myself.

    Sure, I...
Results 1 to 23 of 23