Search:

Type: Posts; User: mapunk

Search: Search took 0.00 seconds.

  1. Replies
    9
    Views
    2,743

    #include #include int...

    #include <stdio.h>
    #include <stdlib.h>

    int main(int argc, char *argv[])
    {
    int arraySize[argc-1];
    int i;

    if(argc < 2)
    {
  2. Replies
    7
    Views
    2,708

    lol, thanks...don't know why i didn't think of...

    lol, thanks...don't know why i didn't think of that
  3. Replies
    7
    Views
    2,708

    Yeah, it took out all the spaces/tabs and what...

    Yeah, it took out all the spaces/tabs and what not, but it was getting a bunch of other random data from other parts of the memory (which is b/c its not terminating when it should) But, I thought...
  4. Replies
    7
    Views
    2,708

    how come this doesn't work for me? ...

    how come this doesn't work for me?



    #include <stdio.h>
    #include <string.h>
    #include <ctype.h>

    #define MAXSIZE 80
  5. Replies
    7
    Views
    1,682

    then could you just do this: ...

    then could you just do this:



    while(fgets(item, 25, inputfile) != EOF )
    {
    if (!strcmp(item, "End of file"))
    {
    printf ("\n%s", item);
    }
  6. Replies
    5
    Views
    1,450

    is it always going to be: something AND...

    is it always going to be: something AND something? As in, apples and oranges, or grapes and plums, or is there a possibility there will be more than 3 words?
  7. Replies
    7
    Views
    1,682

    would this work? while (!strcmp(fgets...

    would this work?



    while (!strcmp(fgets (item, 25, inputfile)), "End of file")
    {
    printf ("\n%s", item);
    }
  8. Replies
    3
    Views
    1,849

    i went with the atoi...thanks for the help

    i went with the atoi...thanks for the help
  9. Replies
    3
    Views
    1,849

    copy contents of array to single value?

    I have an array, lets call it buffer.

    buffer[0] = 9
    buffer[1] = 2
    buffer[2] = 3

    how would i get a variable, x, to equal 923 (not only those numbers, but the contents of the buffer, whatever...
  10. Replies
    6
    Views
    2,301

    no b/c i'm going to be reading in different...

    no b/c i'm going to be reading in different files, so i can't initialize the array to anything
  11. Replies
    6
    Views
    2,301

    Yeah that's my problem, I dunno how to assign say...

    Yeah that's my problem, I dunno how to assign say buffer[0], buffer[1], and buffer[2] to one array value instead of three. What should I do?
  12. Replies
    6
    Views
    2,301

    I'm incrementing the buffer (i) and the column...

    I'm incrementing the buffer (i) and the column (k) whenever I find a number. I increment the row (j) at the very end, when the first while loop has to go to the top again.
  13. Replies
    6
    Views
    2,301

    more help...2d arrays in structures - sscanf

    I'm reading in this file:



    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 3 3 3 3 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 15 15 15 0
    0 3 0 0 0 0 0 7...
  14. try putting this into a program, and...

    try putting this into a program, and experimenting with it:



    fgets(buffer, 10, stdin);
    printf("%s", buffer);


    you'll notice that you're right on all conditions.
  15. Replies
    2
    Views
    1,439

    EDIT: nevermind, I didn't see that you made the...

    EDIT: nevermind, I didn't see that you made the function a pointer...I didn't catch that. Thanks for the help. It worked :)

    And thanks about that #define thing...i just wrote that quickly in...
  16. Replies
    2
    Views
    1,439

    passing by reference

    what's wrong with this? I get this error: The error refers to the red line.



    (in my header file)


    #define MAX_TEST 80;

    typedef struct {
  17. Thread: fgets help

    by mapunk
    Replies
    4
    Views
    1,300

    second question. I'm reading a line such as...

    second question. I'm reading a line such as this:


    200 100

    how would i go about setting the first number to the image height and the next to the width?

    I know this isn't right....at all,...
  18. Thread: fgets help

    by mapunk
    Replies
    4
    Views
    1,300

    ahh thanks. And i know about the file name, I...

    ahh thanks. And i know about the file name, I actually have a variable there, but changed it just so it was easier to interpret...just forgot the quotes when i changed it
  19. Replies
    11
    Views
    2,117

    hmmm I copied your code and made it into a main...

    hmmm I copied your code and made it into a main function so I could run it, and its working fine. I added some printf's so i could see if it was working correctly, and it seemed to be. here's the...
  20. Thread: fgets help

    by mapunk
    Replies
    4
    Views
    1,300

    fgets help

    I'm making a program that has to read in and manipulate a pgm file. I need to make sure the first line in the file is P2, not P5. How would i go about doing this?

    so far i have something like...
  21. Replies
    8
    Views
    2,066

    strlen and strcpy...they're in both strings.h and...

    strlen and strcpy...they're in both strings.h and string.h


    k so now i have this code, and when I try to input the information, it only allows me to enter the planet.name once, but i can enter...
  22. Replies
    8
    Views
    2,066

    ohh thanks. didn't see that missing &. And...

    ohh thanks. didn't see that missing &. And yeah, it needs to be <= 8 so it includes the 9th planet. Thanks alot, I"ll try those out. And why can't it be strings.h? I've never used string.h....
  23. Replies
    8
    Views
    2,066

    I've always used strings.h in my class. But...

    I've always used strings.h in my class.

    But that's not relevant, b/c i haven't put in the code yet that needs strings.h. I didn't use my MAXSIZE either...
  24. Replies
    8
    Views
    2,066

    help with structure arrays

    I read the rules, and no i'm not asking anyone to do my homework...I want to know what i'm doing wrong with these structure arrays. I've tried to figure it out but i still can't get it. Here's the...
Results 1 to 24 of 24