CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: codingnewbie

Page 1 of 2 1 2

Search: Search took 0.03 seconds.

  1. Re: Few Qs about Cconventions (variable naming and variable/argument ordering etc)

    Thanks for the info
  2. Few Qs about Cconventions (variable naming and variable/argument ordering etc)

    1. Should I name an unchanging variable received as input from the user when starting a program with all CAPS like a constant?

    2. When declaring variables at the start of a function, is there any...
  3. .htaccess prompts for password for every image in dir

    I have a directory with a .htaccess file within it, and a folder in the same directory containg thumbnail images. The actual page where the thumbnails are displayed is above these directories and...
  4. Re: How do I specify types with exact byte lengths?

    Thanks for the info. I was just trying to make a program that produced a wav file with a simple sine wave and needed specific sizes for the header and audio data. It was just a test and it worked...
  5. How do I specify types with exact byte lengths?

    I need a two byte integer and a four byte integer. I could use a short and an int, but how I would specify such integers so as to guarantee their length?
  6. Re: Can i declare a char and a char array on the same line?

    Ok the problem was that I forgot that with the range specifier you need to have enough room for a terminating null byte as well, so that was overwriting the first byte of the next declaration with a...
  7. Re: When scanf fails, can I tell if stdin is empty?

    Thanks, I ended up making my own simple scan function though, which stores either characters, or digits converted to integers, in a supplied void pointer array, along with the last character taken...
  8. Re: Can i declare a char and a char array on the same line?

    This is the scanf line: res = scanf("%1[yn]", &chr); Is there anything wrong there?
  9. Can i declare a char and a char array on the same line?

    I had a char "chr" and a char array "filename" declared on the same line "char chr, filename[256];", and i was getting a weird segmentation fault when i tried to free an array of char pointers for...
  10. Replies
    4
    Views
    939

    Re: GDB - Continuously display locals?

    thanks for the suggestions, i'll give them a try
  11. Replies
    4
    Views
    939

    GDB - Continuously display locals?

    I am using gnu deugger and want to have it continuously display the local vars. I can use `info locals` to display them once, but I'm not sure how to keep them displayed. It is tedious using `disp` ...
  12. Re: When scanf fails, can I tell if stdin is empty?

    You mean do it manually?
  13. When scanf fails, can I tell if stdin is empty?

    i need to determine whether stdin is empty when scanf fails, because if it isn't I want to get a character from it with getc. If I use getc when it is empty though it will prompt the user for input...
  14. Re: Evaluation order of expression with single AND operator?

    Thanks for all the replies. I do realize it wont make it any faster, but I actually find it easier to read this way due to it being only one line rather than two, adding another level of indentation.
  15. Evaluation order of expression with single AND operator?

    I have an expression in C: if (aaa = bbb && (ccc = getc(stdin)) != ddd), and I need the first expression to be evaluated first. Does C, and for that matter other programming languages, always...
  16. Re: file.open won't work without literal.

    Thanks Philip
  17. file.open won't work without literal.

    This works:
    fProfList.open("profList.txt", ios::in);
    This doesn't:
    fProfList.open(temp, ios::in);

    error = 91 C:\Dev-Cpp\programs\fiotest2.cpp no matching function for call to...
  18. Re: Best way to write modified text back to a file?

    Nice, thanks!
  19. Re: Best way to write modified text back to a file?

    I have another problem. How do I write the vector back to the file with a new line after each element EXCEPT the last? At the moment with this:
    for (ref = container.begin(); ref != container.end();...
  20. Re: Best way to write modified text back to a file?

    Oh I see, I have to use an iterator to delete the whole element. Silly me!
  21. Re: Best way to write modified text back to a file?

    Thanks, I forgot about that mode! I have one more question though. When I use erase() on the vector it only seems to delete the text and not actually get rid of the element. How do I get rid of the...
  22. Re: Best way to write modified text back to a file?

    Thanks, but could you be a bit more specific. Here is my current code:



    #include<fstream>
    #include<iostream>
    #include<string>
    #include<vector>

    using namespace std;
  23. [RESOLVED] Best way to write modified text back to a file?

    I want to read the text of a file to a vector, then add or delete some stuff and then save the vector back to the file, but I'm not exactly sure how to do it. For example if I just write the modified...
  24. Replies
    4
    Views
    817

    Re: Having a problem with a while loop

    cool, thanks
  25. Replies
    4
    Views
    817

    Re: Having a problem with a while loop

    Cheers, that works well :). What does the clear() function do though when used with i/o though and why do i need to use it?
Results 1 to 25 of 26
Page 1 of 2 1 2





Click Here to Expand Forum to Full Width

Featured