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...
Type: Posts; User: samadhi
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...
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...
The code for fread_to_eol:
void fread_to_eol( FILE *fp )
{
int c;
do
{
if( feof( fp ) )
{
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...
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;
...
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...
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...
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 )...
Thanks for replying so quickly to this! I have made the change so hopefully this should completely remove the possibility of an unterminated string.
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...
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...
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.
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...