I get it, I misred the strings part in your previous post. I know enough.
Type: Posts; User: django
I get it, I misred the strings part in your previous post. I know enough.
You are right. It is too early for me to know even the simplests of things.
Ok, so you simply have to write your own functions to compare, add, subtract and multiply strings made up of integers?
I am by no means an experienced c programmer, maybe a few lines ahead of you...but I have experienced that you get strange results when you tell printf to print a double which you do by '%d' while...
Hehe, thanks. I thought of it, instead of using floating point, I could simply use int + precision. Then you would somehow have to demand that all numbers are entered with the same precision and you...
I need to compare some monetary values. Fixed point is not supported in C. I know there is enough material out there to spend a few PhD's on (including a special GNU library), but it will bog me...
I got it. It was a linking error. I was misled by the fact that it never called something from the messaging.c file and therefore thought the linking was ok, which it was not. Thanks.
It was linking before.
I have warnings to maximum (on gcc -Wall).
Come to think of it, everything that I used until now where structures that were in the messaging.h file, this is actually the...
I just added a function (addToMsgQueue) to one of my sourcefiles (messaging.c) and to its header (messaging.h), compiled into a shared library, and now am trying to compile a third file -...
Thank you all, very helpful again. I know enough to proceed.
Ok, makes sense.
What grumpy suggests is quite useful. I would also be interested in how you would approach polymorphism like designs in C.
I just want to make sure: if you cast something from...
Depends. There are for example order messages which are all orders (like: I want to buy this and that) but who vary a little with respect to the member fields. They get processed in comparable ways....
I have a function that produces several messages which are implemented as different structs. The only thing the messages have in common is a member called 'type' to indicate which type of message it...
Thank you so kindly. I will try to keep it at the garage and car level.
Let me then ask you one more question about a specific car and a specific garage....
Suppose I have a struct like this:
...
Funny as the garage story may be, it does not help me a lot. I did allocate memory, and I currently I fail to see what is wrong there although I would be truly grateful if I was pointed to flaws in...
........ yes I see it now,sorry. My Goodness, this did it, it works. Men, so much trouble over one typo!
I would still like to know if the thinking behind my malloc's (above) is seriously flawed....
struct keyValuePair {
int key;
char *value;
struct keyValuePair *next;
};
struct keyValuePair *parseMessageString(char *aMessageString) {
//set walker to the first position of the first...
Ok, I see what you mean. But the '+1" was merely intended as one extra byte for the '\0'. So I am only 1 off. (but Iguess this can be fatal). Anyway, I corrected it but it does not change anything.
Ok, makes sense. Let me briefly explain my thinking behind every malloc and maybe you can correct any wrong thinking.
char *key = malloc(MAXFIELD * sizeof(*key + 1)); /* char *key...
I put this line in for the following reason.
At first, I had value declared just as a char pointer. What then happened was,t hat the pointer firstPair, who is supposed to point at the first record,...
I have a function that walks through a message string. The message string has a begin indicator, and an END indicator en a Separator to separate the key=value pairs in the string. It should return a...
I am running windows, should have said that.
I am making a c-program that uses shared libraries. Compilation is ok both of the executable and of the .so file. I run the file from my \bin directory, but I have compiled the .so file to the \lib...
Thanks professor (no pun intended). Such background info about how to think about what a header file is, is really helpful: all you need to know in order to be able to use a library. The definitions...
Yes we were, but it's clear now, I defined the structs in the header file. What I find strange however, is that I cannot do this in the original c-file. If I want to make the original c-file into a...