Search:

Type: Posts; User: Simon

Page 1 of 2 1 2

Search: Search took 0.00 seconds.

  1. Replies
    2
    Views
    2,929

    There are a fair few errors in this from what i...

    There are a fair few errors in this from what i can see. You are mainly using the one variable name - that being name[i]



    printf("Enter the Name you are Searching for: ", name[i]);
    ...
  2. Replies
    18
    Views
    12,004

    Thanks Hammer. Always good.

    Thanks Hammer.

    Always good.
  3. Replies
    18
    Views
    12,004

    so let me just summarise: >>char buf; needs...

    so let me just summarise:

    >>char buf;
    needs to be declared because when the compiler sees fgets() it needs to know how big the file is

    >>#define BUFSIZ 4028
    i'm guessing this isn't necessary
  4. Replies
    18
    Views
    12,004

    I posted it before but are buff and bufsiz...

    I posted it before but are buff and bufsiz standard variable names, do they have to be used and are they only used to show the size of the file?
  5. Replies
    18
    Views
    12,004

    In this code #include int main...

    In this code



    #include <stdio.h>
    int main ( ) {
    char buff[BUFSIZ];
    FILE *fp = fopen( "file.txt", "r" );
    if ( fp == NULL ) { /* error */ }
    while ( fgets( buff, BUFSIZ, fp )...
  6. Replies
    18
    Views
    12,004

    The screen, (otherwise known as stdout):D

    The screen, (otherwise known as stdout):D
  7. Replies
    18
    Views
    12,004

    OK, this should be the end. So what happens in...

    OK, this should be the end.

    So what happens in this:



    while ( fgets( buff, BUFSIZ, fp ) != NULL ) {
    fputs( buff, stdout );
  8. Replies
    18
    Views
    12,004

    are you referring to - ...

    are you referring to -

    http://www.eskimo.com/~scs/C-faq/top.html?

    or something else?
  9. Replies
    18
    Views
    12,004

    while ( fgets( buff, BUFSIZ, fp ) != NULL ) { ...

    while ( fgets( buff, BUFSIZ, fp ) != NULL ) {
    fputs( buff, stdout );


    could you explain what while ( fgets( buff, BUFSIZ, fp ) != NULL ) is doing, with buff and BIFSIZ, are they standard...
  10. Thread: sort

    by Simon
    Replies
    6
    Views
    1,444

    Sorry, but i can't really figure it out, int...

    Sorry, but i can't really figure it out,


    int n=sizeof(u)/sizeof(int);


    Is it really necessary to be using sizeof?
    Isn't it just getting the size of the array?
  11. Thread: sort

    by Simon
    Replies
    6
    Views
    1,444

    #include void sortdescending(int...

    #include <stdio.h>

    void sortdescending(int u[], int n);
    void sortascending(int u[], int n);
    int main(void)
    {
    int u[]={333,111,444,555,999};
    int n=sizeof(u)/sizeof(int);
    int k;
    int choice;
  12. Replies
    18
    Views
    12,004

    Printing out contents of a file to the screen

    Gday all,

    I'm trying to get all this file processing under control and i am having a bit of trouble.

    I think i can create a file ok and store information into it, but i'm not sure if there is a...
  13. Thread: Casting malloc?

    by Simon
    Replies
    44
    Views
    21,435

    Thanks Salem, Always Very Reliable.

    Thanks Salem,

    Always Very Reliable.
  14. Replies
    44
    Views
    182,708

    Sticky: Thanks Salem, Always Very Reliable.

    Thanks Salem,

    Always Very Reliable.
  15. Replies
    44
    Views
    182,708

    Sticky: Re: Casting malloc?

    so instead of this:


    which casts malloc as a char*,
    you would be better to do this:

    t=malloc(26 * sizeof(char));
    ???
  16. Thread: Casting malloc?

    by Simon
    Replies
    44
    Views
    21,435

    Re: Casting malloc?

    so instead of this:


    which casts malloc as a char*,
    you would be better to do this:

    t=malloc(26 * sizeof(char));
    ???
  17. Thread: Casting malloc?

    by Simon
    Replies
    44
    Views
    21,435

    Casting malloc?

    Gday,

    Just wondering, i have read a fair bit that you shouldn't cast malloc and i am just wondering what casting actually is e.g

    from another post

    example t=(char*)malloc(26 * sizeof(char));...
  18. Replies
    44
    Views
    182,708

    Sticky: FAQ: Casting malloc?

    Gday,

    Just wondering, i have read a fair bit that you shouldn't cast malloc and i am just wondering what casting actually is e.g

    from another post

    example t=(char*)malloc(26 * sizeof(char));...
  19. Replies
    5
    Views
    14,990

    thats quite funny

    thats quite funny
  20. Replies
    10
    Views
    9,913

    Does anyone know if there is a place that i can...

    Does anyone know if there is a place that i can get information on how to comment in a program properly? and overall documentation.

    Thanks Guys,

    Simon
  21. Replies
    10
    Views
    9,913

    Thanks hammer, you are a qualified champion.:D

    Thanks hammer, you are a qualified champion.:D
  22. Replies
    10
    Views
    9,913

    Thanks for pointing that out Quzah, it is always...

    Thanks for pointing that out Quzah, it is always the little things. however - same problem

    For example if there are 5 records then the last record would be [4] correct? If i want to get rid of the...
  23. Replies
    10
    Views
    9,913

    Cannot delete last element in array

    Hi, i'm wondering if someone can tell me why this deleting function will not erase the final element in the array
    I can delete all others except for the last element
    The function is in blue


    ...
  24. Replies
    1
    Views
    1,461

    Need Help with syntax and overall problems!

    Hey guys, i've been working on this program and finally i am trying to implement a menu.
    I've written the code, but now i'm having heaps of problems with things such as returning to the menu, and...
  25. Replies
    5
    Views
    42,194

    Is there any way i would be able to use strcpy to...

    Is there any way i would be able to use strcpy to delete a record and just overwrite the record to be deleted with the last one in the array and then resort?

    e.g. strcpy(details[recordtobedeleted]...
Results 1 to 25 of 34
Page 1 of 2 1 2