Download Pelles C here: http://www.pellesc.se
OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE
FindChar PROC src:DWORD,char:DWORD
mov eax,DWORD PTR [esp+4]
mov ecx,DWORD PTR [esp+8]
dec eax
@@:
inc eax
mov dl,BYTE PTR [eax]
mov dh,dl
xor dl,cl
sub dx,0101h
or dl,dh
cmp dl,255
jnz @b
retn 8
FindChar ENDP
OPTION PROLOGUE:PrologueDef
OPTION EPILOGUE:EpilogueDefExitProcess PROTO :QWORD
printf PROTO C :QWORD,:VARARG
.data
mystr db 'This is a test.',0
f1 db 'Address of the string = %X',13,10
db 'Address of the character a = %X',0
.code
FindChar PROC src:QWORD,char:QWORD
mov rax,rcx
dec rax
@@:
inc rax
mov cl,BYTE PTR [rax]
mov ch,cl
xor cl,dl
dec ch
dec cl
or cl,ch
cmp cl,255
jnz @b
ret
FindChar ENDP
start PROC PARMAREA=4*SIZEOF(QWORD)
invoke FindChar,ADDR mystr,'a'
invoke printf,ADDR f1,ADDR mystr,rax
invoke ExitProcess,0
start ENDP
END start
Quote from: TimoVJL on August 24, 2026, 12:09:34 PME4 is Lower case n with acute

Quote from: John Z on August 23, 2026, 10:09:58 PMFor example codepage 852 E4 is n with diacritichttps://www.ascii-codes.com/cp852.html
#include <dirent.h>
#include <locale.h>
...
setlocale(LC_ALL, "");
...
_DIR *dir;
struct _dirent *dirent;
dir = _opendir(path); // Open the folder
...
dirent = _readdir(dir); // Read first entry in folder // Read first entry in folder
if (dirent == NULL)
{ perror(path);
return 1;
}
while (dirent != NULL) // While not at end of folder
{
printf("dirent->d_name = %s\n", dirent->d_name);
...
Which results indirent->d_name = Art of Beksinski 1978 (MHS) (2).jpgLater code tries to open the files found:FILE *fh = fopen(fn, "rb");which of course results in an error message:Couldn't open test data\Art of Beksinski 1978 (MHS) (2).jpg: No such file or directoryThe actual filename is "Art of Beksiński 1978 (MHS) (2).jpg" with a diacritic on the "n". _readdir() worked as expected for "00tést.jpg" which has a diacritic on the "e"..386
.model flat,stdcall
option casemap:none
ExitProcess PROTO :DWORD
printf PROTO C :DWORD,:VARARG
.data
mystr db 'This is a test.',0
f1 db 'Address of the string = %X',13,10
db 'Address of the character a = %X',0
.code
OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE
FindChar PROC src:DWORD,char:DWORD
mov eax,DWORD PTR [esp+4]
mov ecx,DWORD PTR [esp+8]
dec eax
@@:
inc eax
mov dl,BYTE PTR [eax]
mov dh,dl
xor dl,cl
dec dl
dec dh
or dl,dh
cmp dl,255
jnz @b
retn 8
FindChar ENDP
OPTION PROLOGUE:PrologueDef
OPTION EPILOGUE:EpilogueDef
start:
invoke FindChar,ADDR mystr,'a'
invoke printf,ADDR f1,ADDR mystr,eax
invoke ExitProcess,0
END start
include fileIO.inc
; Exit codes returned by WriteFileToDisc
; INVALID_HANDLE_VALUE equ -1 ; CreateFile API error
WRITEFILE_ERROR equ 0 ; WriteFile API error
WRITEFILEDISC_OK equ 1 ; Operation successfull
.code
WriteFileToDisc PROC pFileName:QWORD,pMemory:QWORD,nSize:QWORD PARMAREA=7*SIZEOF QWORD
; pFileName : pointer to the file name
; pMemory : address of the data block to write to disc
; nSize : number of bytes to write
LOCAL hFile:QWORD
LOCAL BytesWritten:QWORD
LOCAL ExitCode:QWORD
LOCAL _pMemory:QWORD
LOCAL _nSize:QWORD
mov _pMemory,rdx
mov _nSize,r8
invoke CreateFile,pFileName,GENERIC_WRITE,0,0,\
CREATE_ALWAYS,0,0
cmp eax,INVALID_HANDLE_VALUE
je _exitB
mov hFile,rax
mov rcx,rax
mov ExitCode,WRITEFILE_ERROR
lea r9,BytesWritten
invoke WriteFile,rcx,_pMemory,_nSize,r9,0
test rax,rax
jz _exitA
mov ExitCode,WRITEFILEDISC_OK
_exitA:
invoke CloseHandle,hFile
mov rax,ExitCode
_exitB:
ret
WriteFileToDisc ENDP
END
Page created in 0.028 seconds with 22 queries.