Jump to content

Green Baron

Members
  • Posts

    2,989
  • Joined

  • Last visited

Everything posted by Green Baron

  1. Did you glue the poor cat to the shelf ? Watched the hike through the depths of Moria and the bridge of Khazad Dhum (or whatever it is called) with a spider. The spider (one of these hunting spiders, maybe 5cm with legs) took its time crawling through the projector field from lower right to upper left (i spent some time trying to calculate OpenGL coordinates) and even a "Fly, you fools !" couldn't accelerate it. I was too lazy (and a cat was sleeping on my lap) and the family visitors who were watching were so amused, we let it live. :-)
  2. *lol* The first post in this forum and it is about food. Welcome to the crazy rocket crews :-) Edit: oh, it says "0 posts" under your avatar, never mind, maybe it wasn't the first one ?
  3. 509 "A small gap for me ..."
  4. 461 Jumping over the gaps from prime to prime ... "It's a prime time, maybe the stars were right ...." (Alan Parsons Project)
  5. Got a bunch of fresh basil and will have a GIANT caprese salad now (Tomato, fresh mozarella cheese, balsamico (red wine vinegar)). Buen provecho !
  6. Did you write python scripts or any plugins for Blender for this ?
  7. It does. 4 piston strokes = 2 revolutions of the crank shaft.
  8. For flying to Mars ? No. It needs a medium to accelerate. For flying in an atmosphere ? No or with goodwill not yet. Too ineffective to be useful. It was only a prolonged glide angle. "There is still a long way to go." they say. Length undefined :-)
  9. I have to guess, since you haven't told us what the program shall do. You want to create a new string by concatenating two strings, correct ? You don't need a temp variable for this, you need the source string, the dest string and a pointer var for the return value of the function. Work through the first chapters of the book you bought, then you will catch up with "Einstein" :-) Or do you want to append a single char to a string ? These are different things ... Edit: i have spent more time i wanted to prepare a few examples of how things work. If somebody finds an error, pls tell me, it is quick and dirty, and of course there are more than one ways. There are two kinds of mem handling you can use by switching remarks. #include <string.h> // strcpy(), strcat() #include <stdlib.h> // malloc(), free(), EXIT_SUCCESS #include <stdio.h> // puts(), stdout #define MAX_SIZE 100 int main() { // Version 1: dynamic allocation // char *texttoadd = (char *)malloc( MAX_SIZE ); // Version 2: static allocation char texttoadd[MAX_SIZE]; // concatenate two strings: const char Characters[] = "some arrangement of charactersX"; // copy const string into working string, including trailing \0 // 'Characters' decays implicitly into a pointer to its first element: &Characters[0] char *retval0 = strcpy( texttoadd, Characters ); puts( retval0 ); // concat the string from position 10 to the end to the existing string, append \0 char *retval1 = strcat( retval0, &Characters[10] ); puts( retval1 ); // append a single char at the end of a string: const char c = 'P'; char *retval2 = strncat( retval0, &c, 1 ); puts( retval2 ); // or, if you are absolutely sure that there is enough space in the string: size_t l = strlen( texttoadd ); texttoadd[l] = c; // simply assign the position at the end of the string texttoadd[l+1] = '\0'; // do not forget ! puts( texttoadd ); // equivalent: puts( retval2 ); // Version 1 cleanup: free dynamically allocated memory // free( texttoadd ); puts( "\n\nEnding normally\n" ); // Version 2 will be cleaned up when leaving the scope return EXIT_SUCCESS; }
  10. There are missing semicolons, sure it compiles ? Usually a leak describes the situation that an allocated space is not freed correctly. Since there are no visible allocations (and btw. no pointers) i can't see any leaks. But of course you must allocate space for text_to add_to before using it in strcat(). So, no, i don't see leaks in these lines, but it is undefined as long as you don't allocate space. I am sorry but i cannot say any more before seeing the whole program ... Snippet to deal with the allocation thing (Level 0 in terms of gaming ;-), it is quite a time since i last did this): #include <string.h> #include <stdlib.h> #define MAX_SIZE 100 int main() { char *texttoadd = (char *)malloc( MAX_SIZE ); /* Do things, but remember not to exceed 99 chars + \0. Depending on the functions you use \0 may be added by them or you must do so by hand. -> man 3 strcat() didplays the help, if you're in a terminal ... */ free( texttoadd ); }
  11. I fear this is a misconception. The MHD works by accelerating a conductive propellant. It is useless in space. Even on earth (am thinking of marine applications) it is too inefficient to do something useful with it. The text you linked doesn't make any sense to me ...
  12. On second thought, the concept of the heliosphere in comparison to the hill sphere may be more convenient for this "use case". If we took the hill spheres of every sun in a galaxy, there'd be hardly any interstellar space, only areas with very low gravity. Though, if somebody planned to travel to the next star he/she/they would have to do that along the "lines" of gravity, exiting one system on a para- or hyperbole and enter the next one on a similar trajectory/orbit/stone's throw.
  13. You are right, nothing will break. In all the times of C/C++ there apparently never was something that broke anything that was before. Work your way through it. There are lot of concepts you need to understand, data types, operators, conversions, control structures, functions, .... That will be your solid foundation and you will always need it. Have fun :-)
  14. Hey guys, i simply meant Keplerian Orbits, the ones we love and hate, depending on whether they bring us to were we want to go or not. If you prefer trajectory for the open orbits, no problem. We all know now where the V'gers are and i have learned new definitions of interstellar space or medium. I mean, in the end, we all "orbit" the Great Attractor, until expansion of space us parts. :-)
  15. Na. I only have 10 fingers. More than the carpenter up the road, but still not enough. According to my brute force c function the next prime number is 191
  16. A para- or hyperbolic orbit is still an orbit. Orbits aren't limited to captive ones like ellipses or circles. I see, there is an ambiguity for the term "interstellar space", that can be either interpreted as the surrounding medium or the gravitational influence. I wasn't aware.
  17. I have a question though, why is the electromagnetic sphere preferred over the gravitational sphere for the definition of interstellar ? The probes have entered interstellar gases, but are still orbiting the sun. Even Voyager 1 isn't in the Oort cloud yet, or is it ?
  18. Your Einstein might just have typed down one of the numerous examples from the web, like i did some time ago with OpenGL and Vulkan. Don't be distracted by that. If your teacher isn't helpful there is still the own initiative to learn independently. There is always the freedom to decide "Now i'll do it better !" and dig into it. It might take some time, effort and nerves. Would be the first time if not ;-) Your English is far better than mine !
×
×
  • Create New...