Hi all again, Thanks all for the responses to my lock record doubt. I have another problem... I'm developing a linux application with GTK. When i launch and ic_read with a main program without GTK all works fine but, if i launch the same code with a GTK GUI, i have problems with the encoding (gtk returns gtk_utf8_validate error). Using gtk, when i try to split a record, don't found the separator I_FM... ?Any idea?
This is the sample code: //Abrimos sesisn session_id = ic_opensession(xhost, xusuario, xpassword, xcuenta, &code, NULL); if (code != 0){ fprintf(stderr, "Failed to open session. Code = %d\n", code); } //Abrimos el fichero UP long id_fichero; long nombre_len; long flag = IK_DATA; long status_func; nombre_len = strlen(fichero); ic_open (&id_fichero, &flag, fichero, &nombre_len, &status_func, &code); printf("Status of function: %d \n",status_func); if (code != 0){ fprintf(stderr, "Failed to open file. Code = %d\n", code); return; } flag = IK_READU; nombre_len = strlen(registro); //Leemos el fichero //TODO Habra que cambiarlo para leerlo secuencial porque si es muy grande no cabe en el buffer ic_read(&id_fichero,&flag,registro,&nombre_len,buffer,&tam_buffer,leido,&status_func, &code); if (code != 0){ fprintf(stderr, "Failed to read record. Code = %d\n", code); long code2; ic_close(&fichero,&code2); return; } ////////////////////////////////////////////////////// int field = 1; printf("Size of record = %d\n", *leido); printf("Record contents:\n"); printf("Field %02d: ", field); int i=0; for (i=0; i< *leido; i++) { unsigned char ch = buffer[i]; if (isprint(ch)) putchar(ch); else if (ch == I_FM) { field++; printf("\nField %02d: ", field); } else printf("---->\n%02x\n", ch); } putchar('\n'); ///////////////////////////////////////////////////// ic_close(&id_fichero,&code); if (code != 0){ fprintf(stderr, "Failed to close file. Code = %d\n", code); return; } Thanks again!!! ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/