Search:

Type: Posts; User: samadhi

Search: Search took 0.00 seconds.

  1. Replies
    9
    Views
    5,643

    Thanks for the help Quzah :cool: as always your...

    Thanks for the help Quzah :cool: as always your advise is spot on.

    I have compiled and run the program and it does correctly detect the EOF.

    Guess it is time to try running my code through gdb...
  2. Replies
    9
    Views
    5,643

    I know, this is why I am confused :confused: ...

    I know, this is why I am confused :confused: the only thing I could think of was that vi must have code to handle files that do not end on '\0'.
    Is it possible that vi checks the length of the...
  3. Replies
    9
    Views
    5,643

    The code for fread_to_eol: void fread_to_eol(...

    The code for fread_to_eol:

    void fread_to_eol( FILE *fp )
    {
    int c;

    do
    {
    if( feof( fp ) )
    {
  4. Replies
    9
    Views
    5,643

    I have just tried a test using a corrupt file I...

    I have just tried a test using a corrupt file I have saved off last time the program was terminated abnormally during a write.

    Firstly I tried to start the program with the corrupt file and it...
  5. Replies
    9
    Views
    5,643

    The datafiles only contain ascii data, here is...

    The datafiles only contain ascii data, here is the code I have to read in each item from a data file:
    void *read_next_item( FILE *fp, int *status )
    {
    char *word;
    void *value = NULL;
    ...
  6. Replies
    9
    Views
    5,643

    Check for missing EOF

    Is it possible to check for a missing EOF?

    I have a program that uses data files to store data and it reads and writes from the files with no problems at all, however I occassionally get an issue...
  7. Replies
    2
    Views
    1,208

    Thanks Hammer, that is a totally excellent answer...

    Thanks Hammer, that is a totally excellent answer that actually makes sense of pointer functions! I have read C books before and never really comprehended how they could be so useful and so have...
  8. Replies
    2
    Views
    1,208

    Void pointer use in a function

    I am trying to write a general purpose function to display key fields that are common across a number of different data structures. I want to call this function using:
    display_text( pStruct, type )...
  9. Replies
    4
    Views
    1,691

    Thanks for replying so quickly to this! I have...

    Thanks for replying so quickly to this! I have made the change so hopefully this should completely remove the possibility of an unterminated string.
  10. Replies
    4
    Views
    1,691

    Thanks for the help Quzah, I thought this was the...

    Thanks for the help Quzah, I thought this was the case.

    In this case I don't think I have to worry about the size of the string as all of the calls to the function pass a buffer that has a...
  11. Replies
    4
    Views
    1,691

    Question regarding pointer manipulation

    Hi, I was trying to modify a function designed to split a string onto multiple lines and indent it. This function was written by someone else and when I came to check the end of the code I found the...
  12. Replies
    4
    Views
    3,808

    Thanks for all of the help, I think it is clear...

    Thanks for all of the help, I think it is clear that the second method is probably the method of choice to use.

    Thanks for the tip about passing the size inside the function call as well.
  13. Replies
    4
    Views
    3,808

    Best practice: string manipulation functions

    Hi,
    I am fairly new to C coding and have a question regarding the best practice when using functions to manipulate strings. Basically I would like to know should I write a function like:

    char...
Results 1 to 13 of 13