Beginners_-_SetClipboard_mergeintegers.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #include "raylib.h"
  2. #include <string.h>
  3. int main(void)
  4. {
  5. // Initialization
  6. //--------------------------------------------------------------------------------------
  7. const int screenWidth = 800;
  8. const int screenHeight = 450;
  9. InitWindow(screenWidth, screenHeight, "raylib example.");
  10. SetTargetFPS(60); // Set our game to run at 60 frames-per-second
  11. //--------------------------------------------------------------------------------------
  12. char output1[16] = "Test1\n"; // new line is '\n'
  13. int i = 247593;
  14. char output2[10];
  15. // put int into output2
  16. sprintf(output2, "%d", i);
  17. // Put output2 behind output1
  18. strcat(output1,output2);
  19. // Copy results to clipboard.
  20. SetClipboardText(output1);
  21. // Main game loop
  22. while (!WindowShouldClose()) // Detect window close button or ESC key
  23. {
  24. // Update
  25. //----------------------------------------------------------------------------------
  26. //----------------------------------------------------------------------------------
  27. // Draw
  28. //----------------------------------------------------------------------------------
  29. BeginDrawing();
  30. ClearBackground(RAYWHITE);
  31. DrawText("Check your clipboard buffer CTRL+V",50,100,20,DARKGRAY);
  32. EndDrawing();
  33. //----------------------------------------------------------------------------------
  34. }
  35. // De-Initialization
  36. //--------------------------------------------------------------------------------------
  37. CloseWindow(); // Close window and OpenGL context
  38. //--------------------------------------------------------------------------------------
  39. return 0;
  40. }