Search:

Type: Posts; User: Simon

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    2
    Views
    2,943

    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,024

    Thanks Hammer. Always good.

    Thanks Hammer.

    Always good.
  3. Replies
    18
    Views
    12,024

    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,024

    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,024

    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,024

    The screen, (otherwise known as stdout):D

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

    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,024

    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,024

    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,448

    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,448

    #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,024

    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,948

    Thanks Salem, Always Very Reliable.

    Thanks Salem,

    Always Very Reliable.
  14. Replies
    44
    Views
    184,783

    Sticky: Thanks Salem, Always Very Reliable.

    Thanks Salem,

    Always Very Reliable.
  15. Replies
    44
    Views
    184,783

    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,948

    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,948

    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
    184,783

    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
    15,041

    thats quite funny

    thats quite funny
  20. Replies
    10
    Views
    9,932

    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,932

    Thanks hammer, you are a qualified champion.:D

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

    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,932

    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,289

    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