Search:

Type: Posts; User: Newworld

Search: Search took 0.01 seconds.

  1. Replies
    1
    Views
    1,343

    parsing command line problem

    I'm writing a C program to implement a shell that supports a few commands... one of them being "exit"

    I made a table of commands that are supported and I wanted to use strcmp to match it to the...
  2. Replies
    5
    Views
    1,772

    fwrite problems

    I'm trying to write some student records to a binary file... Right when my program gets to part where it goes to write my structure to a file I get a segment fault during runtime.

    here is the...
  3. Replies
    9
    Views
    4,155

    hmm, ok I've tried doing the printf debugging and...

    hmm, ok I've tried doing the printf debugging and it seems that I have some major problem when I'm trying to enter the name using


    fgets(r[i].name,30,stdin);

    when entering the info it does...
  4. Replies
    9
    Views
    4,155

    hmm.. I finally got it to compile, but it looks...

    hmm.. I finally got it to compile, but it looks like I'm not correct in my coding for writing my structure to the binary file:

    the program works fine as I go to the student function to enter info,...
  5. Replies
    9
    Views
    4,155

    ahhh yes, i completely forgot about needing a ;...

    ahhh yes, i completely forgot about needing a ; after ) when declaring a structure. Thank you.

    It seems I have just two last errors:

    project2.c: In function `print':
    project2.c:114: warning:...
  6. Replies
    9
    Views
    4,155

    k, fixed the problems... recompiled and still...

    k, fixed the problems...
    recompiled and still getting:

    project2.c:17: two or more data types in declaration of `student'
    project2.c: In function `delete':
    project2.c:62: `rec' undeclared (first...
  7. Replies
    9
    Views
    4,155

    student binary file program....

    I'm writing a program to store information about students using structures. We store the information in a binary file. I am getting some compiler errors using the unix machines at school. I can't...
  8. Replies
    5
    Views
    1,572

    That is the entire code. I guess I will have to...

    That is the entire code. I guess I will have to email my professor because everything I gave you is what is exactly what is given to me.

    edit:
    Assuming there is no typo and x,y,z are just useless...
  9. Replies
    5
    Views
    1,572

    I understand that, what I meant to ask was where...

    I understand that, what I meant to ask was where are x, y, and z being used it this code?
  10. Replies
    5
    Views
    1,572

    Figure out the output of code ...

    I'm having trouble with this assignment which I'm supposed to show what the output would be for this code:


    int x=1;
    int y=2;
    int z=3;

    printf("%d %d\n", 3 | 6, 3 || 6);

    printf("%d %d\n",...
  11. Replies
    22
    Views
    2,537

    ah, ok. Thank you. and I was able to fix my...

    ah, ok. Thank you.

    and I was able to fix my other problems with declaring int i, before the for loop. I guess C doesn't allow you to declare int i in the for loop.

    Lastly, I believe this will...
  12. Replies
    22
    Views
    2,537

    also as a side question... when i declare...

    also as a side question... when i declare variables in C, is it ok to do it after main() ? Or am I supposed to be doing it all before main() ...

    I am used to java where you can declare variables...
  13. Replies
    22
    Views
    2,537

    yea I changed the: mar = if(leap==0) {...

    yea I changed the:


    mar = if(leap==0)
    { (feb+28)%7;
    } else {
    (feb+29)%7;
    }
    to
  14. Replies
    22
    Views
    2,537

    ah, thank you ... unfortunately the compiler is...

    ah, thank you ... unfortunately the compiler is still giving me the same error, which makes me wonder if it is because I am missing something farther up in the program.
    So here is my entire program:...
  15. Replies
    22
    Views
    2,537

    ah, ok I didn't realize it was ; ... I went...

    ah, ok I didn't realize it was ; ...
    I went through and changed them, but I am still getting the same error, only now it is showing the error only for



    for (int i=1


    I don't know why it is...
  16. Replies
    22
    Views
    2,537

    [QUOTE=Prelude]>for((days-i)>0,i++) The grammar...

    [QUOTE=Prelude]>for((days-i)>0,i++)
    The grammar for a for loop is


    for ( init(opt); condition(opt); increment(opt) )
    statement;

    hmm, I'm a little confused... I don't have any init(opt) for...
  17. Replies
    22
    Views
    2,537

    Compiler error

    Parse error, expecting ''," or 'SEP'

    on this line of code:


    if((days-i)>=7)
    { printf("%d %d %d %d %d %d %d\n",i++,i++,i++,i++,i++,i++,i++);
    } else {
    for((days-i)>0,i++){...
Results 1 to 17 of 17