Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question about "Sub memcpy ..."
#1
While reading the wiki I came across Offset(function): https://qb64phoenix.com/qb64wiki/index.p...(function)

The sub "memcpy" is apparently a fixed procedure, because when I changed the name there was an error during compilation.
What is this "memcpy"? Hard-wired?  I couldn't find anything about it in the wiki.

Code: (Select All)

Option _Explicit

Declare CustomType Library
  Sub zeichenKopieren (ByVal Ziel As _Offset, Byval Quelle As _Offset, Byval Bytes As Long)
End Declare

Dim As String zahlen, buchstaben

zahlen = "1234567890"
buchstaben = "ABCDEFGHIJ"

zeichenKopieren _Offset(zahlen) + 5, _Offset(buchstaben) + 5, 5
Print zahlen

End

Quote:internal\c\c_compiler\bin\c++.exe -Wl,--stack,26777216 -std=gnu++17 -fno-strict-aliasing -Wno-conversion-null -DGLEW_STATIC -DFREEGLUT_STATIC -Iinternal\c\libqb/include -Iinternal\c/parts/core/freeglut/include -Iinternal\c/parts/core/glew/include -DDEPENDENCY_NO_SOCKETS -DDEPENDENCY_NO_PRINTER -DDEPENDENCY_NO_ICON -DDEPENDENCY_NO_SCREENIMAGE internal\c/qbx.cpp -c -o internal\c/qbx.o
In file included from internal\c/qbx.cpp:1894:
internal\c/../temp/maindata.txt: In function 'void QBMAIN(void*)':
internal\c/../temp/maindata.txt:1:55: error: 'zeichenKopieren' was not declared in this scope
    1 | SUB_ZEICHENKOPIEREN=(CUSTOMCALL_SUB_ZEICHENKOPIEREN*)&zeichenKopieren;
      |                                                      ^~~~~~~~~~~~~~~
mingw32-make: *** [Makefile:402: internal\c/qbx.o] Error 1
That is OK.
Code: (Select All)

'12. Juli 2024

Option _Explicit

Declare CustomType Library
  Sub memcpy (ByVal Ziel As _Offset, Byval Quelle As _Offset, Byval Bytes As Long)
End Declare

Dim As String zahlen, buchstaben

zahlen = "1234567890"
buchstaben = "ABCDEFGHIJ"

memcpy _Offset(zahlen) + 5, _Offset(buchstaben) + 5, 5
Print zahlen

End
Reply
#2
MEMCPY() is a C++ statement. My guess is you may be correct is presuming it is 'hard copied' as a C++ library function.

Pete
Reply
#3
(07-12-2024, 05:36 PM)Pete Wrote: MEMCPY() is a C++ statement. My guess is you may be correct is presuming it is 'hard copied' as a C++ library function.

Pete
Ah thanks, that explains the error message.
Reply
#4
Yes, memcpy() is a C function:

Code: (Select All)

//memcpy(), C-Befehlsbibliothek S. 323
//12. Juli 2023

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define GROESSE 50

int main(void)
{
char puffer1[GROESSE], puffer2[GROESSE];

strcpy(puffer1, "Das ist ein Test!");
printf("\nPuffer1: ");
printf(puffer1);

//Inhalt von P1 nach P2 kopieren
memcpy(puffer2, puffer1, GROESSE);
printf("\n\nKopiert nach Puffer2: ");
printf (puffer2);

return(0);
}
Reply
#5
Not to be confused with _MEMCOPY, which is one of our built-in mem commands: https://qb64phoenix.com/qb64wiki/index.php/MEMCOPY
Reply
#6
(07-12-2024, 06:50 PM)SMcNeill Wrote: Not to be confused with _MEMCOPY, which is one of our built-in mem commands: https://qb64phoenix.com/qb64wiki/index.php/MEMCOPY
Yes, thanks! I looked at everything, but couldn't find it using memcpy.
Reply




Users browsing this thread: 1 Guest(s)