typedef struct
{
int length = strlen(this); /* get the length of the string pointed to by the variable declared here */
} *string_sz;
string_sz str = "Hello World!\n";
So str is a pointer to a C string and length is the string's length.
Will that work or do I have some modifications to make to get it to work like a string from the C++ string library?
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
What JohnnyTheDon says. You can pretty much not do that in C, because C doesn't support (as far as I know) nor operator overloading, nor functions in structures.
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
or link to the freebasic runtime (written in C ) and use that string format + functions
In the end, it all boils down to the same thing...
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Also an option, but it only circumvents the problem by not having to write code
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]