User Profile

Collapse

Profile Sidebar

Collapse
Ganon11
Ganon11
Last Activity: Apr 23 '15, 02:11 PM
Joined: Oct 24 '06
Location: Norwalk, Connecticut, United States of America
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Ganon11
    replied to Buffer overflow error
    in C
    whodgson, Banfa, and JosAH are all correct. You can't try to open that garbage - you have no idea what bogus values are in the memory location until you set it yourself. Better get a filename in there, or at least make sure it's null-terminated by the 64th character.
    See more | Go to post

    Leave a comment:


  • Ganon11
    replied to Int vs Text on setText for jbuttons
    in Java
    setText takes a String argument, and requires a String. An int, double, char, etc. won't work. By adding the + "", you are performing string concatenation. Java automatically treats your number (int, double, whatever) as a String (by using its .toString() method or some equivalent), then appends it with the empty string "".

    It's one of those weird things that you just have to get used to.
    See more | Go to post

    Leave a comment:


  • Ganon11
    replied to Help with vectors
    in C
    Try moving your struct definition outside of main().
    See more | Go to post

    Leave a comment:


  • Ganon11
    replied to How do i read a file in from a vector?
    in C
    Since you've commented out the faulty line scores[index++] = aScore, index is no longer getting updated, so your final loop will not work anymore. Try getting scores.size() into a variable and looping based on that instead of index.
    See more | Go to post

    Leave a comment:


  • Ganon11
    replied to srand()
    in C
    seed is not a random function. It is not a random number. seed is an int that you told to be the value of time(0).

    To get random numbers, use the rand() function.
    See more | Go to post

    Leave a comment:


  • Ganon11
    replied to how to compare null string
    in Perl
    happyse27,

    Just to reiterate what KevinADC said, I don't think you've done anything to warrant any sort of 'posting ban'. It was likely an error due to our changing interface. Please try again.
    See more | Go to post

    Leave a comment:


  • Ganon11
    replied to Two compiling errors
    in C
    It really depends on several things. When I am using a command line compiler like g++, I don't need the system("pause") command at the end, since I can just view the output in the command prompt after the program runs. When I use the IDE Dev C++, I need to use that line, because otherwise the window disappears (I've been told running in the non-Debugging mode fixes this, but I've done it in non-Debug mode, and it still doesn't work)....
    See more | Go to post

    Leave a comment:


  • Ganon11
    replied to Multidimensional vector array
    in C
    boxfish is right. In a 2D array, you have to use 2 for...loops to access the array (well, as long as you access it as a 2D array...weaknes sforcats has a great article about this type of nuance in the insights section called Arrays Revealed), so it is expected that you should need 2 for...loops to access every element in a (simulated) 2D vector.
    See more | Go to post

    Leave a comment:


  • Ganon11
    replied to size of an int
    in C
    What!? Absurd. I didn't know C could look like Perl....
    See more | Go to post

    Leave a comment:


  • Ganon11
    replied to Using Tk in wix XP
    in Perl
    It may be that you installed Tk incorrectly (not sure if it came with your installation).
    See more | Go to post

    Leave a comment:


  • Ganon11
    replied to data structure question
    in C
    In addition, the shell of code you were given does not define an iterator. You would have to write your own iterator class to use an iterator here, which I assume is not what was expected of you.

    As Banfa suggested, there is a very simple way to access the elements here.
    See more | Go to post

    Leave a comment:


  • Ganon11
    replied to size of an int
    in C
    With, of course, parentheses around the argument list:

    Code:
    int a, b;
    a = sizeof(b);
    See more | Go to post

    Leave a comment:


  • Ganon11
    replied to help with this please
    in C
    No, neither of those code segments is correct. To declare a variable, you type:

    Code:
    int myInt;
    char myChar;
    // etc...
    Your assignment in the first section is valid, but your assignment in the second section is right - your const float must have a name in addition to a value.
    See more | Go to post

    Leave a comment:


  • Ganon11
    replied to data structure question
    in C
    And what did you write for your answer?
    See more | Go to post

    Leave a comment:


  • Ganon11
    replied to [c++] code seems to be in infinite loop
    in C
    Your code doesn't loop for me...

    The following is test code I created to supplement your function:

    Code:
    #include <iostream>
    using namespace std;
    
    int r[12];
    
    void dump() {
        char value[8];
        for(int a = 1; a < 11; a++) {
            cout << "r" << a << ": \t";
            sprintf(value,"%08X", r[a]);
            for(int
    ...
    See more | Go to post

    Leave a comment:


  • Ganon11
    replied to Changing each value in a struct one by one
    in C
    If these ints are at all related to each other, you can have your struct contain an array of ints, and use array processing techniques to get all the data, convert it, etc.

    If this is all your struct contains, however, you have done little more than make a typedef int mystruct[17]; statement.
    See more | Go to post

    Leave a comment:


  • Ganon11
    replied to how to compare null string
    in Perl
    You can also simply use $company, since the null string is a FALSE value:

    Code:
    if ($company) {
       print "It's not null.\n";
    } else {
       print "It's null.\n";
    }
    See more | Go to post

    Leave a comment:


  • Ganon11
    replied to Program with Class Cards
    in C
    This line:

    Code:
    card[51]=c[51];
    does not do what you think it does. What you want to do is copy the elements of c into card. What you are doing is copying the 52nd element of c into the 52nd element slot of card, and leaving the rest unchanged. If your random number generated happened to generate 51 (to get the 52nd card), you'd probably get 413, like you'd expect - however, the rest of your elements are garbage.
    ...
    See more | Go to post

    Leave a comment:


  • Ganon11
    replied to Clearing the screen
    in Java
    If you are working in a Windows environment, you can execute the "cls" command. If you are working in a Linux environment, you can execute the "clear" command. If you are working in another environment, you can look up the appropriate command line function that clears the screen and execute it.

    Be aware that using commands that are OS-specific means that your code will no longer be portable.
    See more | Go to post

    Leave a comment:


  • It looks like you want either the %ENV variable, or the Env package. Try:

    perldoc Env
    Using a Module
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...