Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.arcetri.astro.it/irlab/library/linux/khg/HyperNews/get/khg/135/2/1.html
Дата изменения: Thu Mar 23 12:37:42 2000 Дата индексирования: Wed Sep 15 04:06:17 2010 Кодировка: Поисковые слова: holographic principle |
I created the following call it is working fine, but i don't know about that bad address. sys call function looks like this. int sys_print_data(char *s1,char *s2,int flag,int size1,int size2) { /* size1 and size2 are strlen of s1 and s2 respectively */ if (flag) { sys_write(1,s1,size1); return 1; else { sys_write(1,s2,size2); return 2; } } This is working fine. But i have another problem. I wrote a function int string_len(char *s), which will return the length of the string as follows. int string_length(char *s) { int len=0; while(*(s+len)) len++; return len; } i am calling this in the sys_print_data instead of passing size1 and size2. Exactly at this call it is saying segmentation fault and dumping all the registers. i also used the standard strlen call(linux/string.h). It is also doing the same. Can any body please clarify this. Thanx in advance, Gopinath |