hey this has now been resolved. thanks :D
Type: Posts; User: chriscolden
hey this has now been resolved. thanks :D
nope its true, we have to make sure it runs on borland c 3.1 for dos as that is the only thing our university will use to teach us.
i'm all for using better development enviroments, i think 1/2 of...
Hi all,
I have a quick sort function which i'm working on however, I am having problems with it. It seems to get stuck in a loop...when ever i break the program its on my comparison function. I...
thanks, sorted out all the errors. cheers
well spotted, i hadn't noticed and nor did borland.
the new line at the begining is just to drop it down so when it outputs in dos its not right at the top of the screen. other languages I like to...
hey,
i have a pointer problem with my compare function.
int dataComp( const void * a, const void * b ) {
float * arg1, arg2;
comps++;
thanks for your help guys, I have sorted them problems and now encountered some more, I will try and work them out before posting again.
cheers
Thanks guys,
I got it accepting the multi lined string as far as i know but now its saying lvalue required
void printHeader( FILE * filePointer ) {
char buffer[500];
buffer = "\n...
Hey,
ok lets start with the one your going to find dead easy.
i am trying to assign a string to this char array over multiple lines however I cannot work out the syntax
char buffer[500];...
Hi thanks for all your help. I decided to go for an Insertion Sort. It was easier to code and will give me better results.
Cheers
Ok i see what your saying but I should never have to modify the head of the list as there is a dummy record sitting at the start. which is why when I first go into the first while loop I move it on...
UPDATE:
I have changed modifing the pointers to simply moving the data between the two. This however had no effect. So i'm now more inclinded to say its the while loops its self.
I have adapted...
ok new problem.
i have the following code to perform an exchange sort
void sortRecords(RECORD * ptrDatabase, int * counter) {
// Setup variables used within function
char temp[5];...
sorry my bad
this is working correctly. my problem was because i forgot to re-terminate terminate the list after creating a new record.
I'm sorry if i have wasted anyones time.
Chris
Hi all.
Hopefully a simple answer but I just can't see it.
I am trying to perform a simple exchange sort on a linked list.
I have had the code working with a normal array but cannot seem to...
thanks for the tip. I have made the changes and all is still working fine.
I have also changed the sizeof(RECORD) to sizeof(**ptrDatabase) as the faq surgested.
Cheers again
Chris
i won't hold my breath but i think, thanks to everyones help here I have managed to get both of my memory functions to work correctly and the program to stop crashing on exit. I'll let you know if i...
int ReallocateMemory(RECORD ** ptrDatabase, int * currentMemSize) {
RECORD * ptrNew;
ptrNew = (RECORD *) realloc(ptrDatabase, (*currentMemSize + memIncrease) * sizeof(RECORD));
if (ptrNew ==...
i have got allocateMemory 2 return and set ptrDatabase. However I'm not sure how i would get reallocateMemory to work as Main calls createEntry which then in turn calls reallocateMemory. is there no...
I see what you mean by the NULL. Would this be right now. I have modified the functions
RECORD * ReallocateMemory(RECORD * ptrDatabase, int * currentMemSize) {
RECORD * ptrNew;
ptrNew =...
i do not understand. It doesn't need to return a valid pointer becuase i pass the address of the pointer into the function. Could i see some code relating to the modifications you recomend. Thanks
int saveDatabaseFile(RECORD *, char *, int *, int *, int *);
int loadDatabaseFile(RECORD *, char *, int *, int *, int *);
int ReallocateMemory(RECORD *, int *);
int AllocateMemory(RECORD *);
...
strcpy will copy one string (array of chars) to another string (array of chars).
char * strcpy ( char * dest, const char * src );
Copy string.
Copies the content pointed by src to dest...
if not changes have been made the program crashes.
if C is entered when changes have been made the program returns to the menu and does not crash.
i was just returning a value to exit the program. thats how we have been told to do it. I'll change it to 0.