- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Why don't work this sub???
CHARACTER*(*) FUNCTION LEERVALOR(FICHERO,SECCION,CLAVE)
USE KERNEL32
CHARACTER*(*) FICHERO,SECCION,CLAVE
INTEGER*4 I
CHARACTER*300 CADENA
DO I=1,300
CADENA(I:I)=' '
ENDDO
I = GetPrivateProfileString(SECCION, CLAVE, '', CADENA, LEN_TRIM(CADENA), FICHERO)
IF (I > 0) THEN
LEERVALOR= TRIM(CADENA)
ELSE
LEERVALOR = ""
ENDIF
END FUNCTION
USE KERNEL32
CHARACTER*(*) FICHERO,SECCION,CLAVE
INTEGER*4 I
CHARACTER*300 CADENA
DO I=1,300
CADENA(I:I)=' '
ENDDO
I = GetPrivateProfileString(SECCION, CLAVE, '', CADENA, LEN_TRIM(CADENA), FICHERO)
IF (I > 0) THEN
LEERVALOR= TRIM(CADENA)
ELSE
LEERVALOR = ""
ENDIF
END FUNCTION
I use this sub to read from a INI file but the routine getprivateprofilestring returns I=0. Why???
I use the same routine in VB and works correctly.
This sub don't work too...
SUBROUTINE GUARDAVALOR(FICHERO,SECCION,CLAVE,VALOR)
USE KERNEL32
CHARACTER*(*) FICHERO,SECCION,CLAVE,VALOR
INTEGER*4 I
I = WritePrivateProfileString(SECCION, CLAVE, VALOR, FICHERO)
USE KERNEL32
CHARACTER*(*) FICHERO,SECCION,CLAVE,VALOR
INTEGER*4 I
I = WritePrivateProfileString(SECCION, CLAVE, VALOR, FICHERO)
END
Message Edited by davidzorro68@hotmail.com on 11-22-2004 01:18 AM
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You specify LEN_TRIM(CADENA) as the length of the buffer to recieve the returned string, but LEN_TRIM returns length after stripping trailing blanks, and CADENA is filled with blanks, so maybe it objects to a zero length (after stripping blanks) buffer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is FICHERO properly char(0) terminated?
Jugoslav

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page