| delorie.com/archives/browse.cgi | search |
| From: | Dave Bird <dave AT xemu DOT demon DOT co DOT uk> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | anyone see what's wrong with this ? |
| Date: | Sat, 6 Mar 1999 22:16:04 +0000 |
| Organization: | very little |
| Message-ID: | <FtJD+DAkka42EwCY@xemu.demon.co.uk> |
| NNTP-Posting-Host: | xemu.demon.co.uk |
| X-NNTP-Posting-Host: | xemu.demon.co.uk:158.152.196.209 |
| X-Trace: | news.demon.co.uk 920758660 nnrp-02:28311 NO-IDENT xemu.demon.co.uk:158.152.196.209 |
| X-Complaints-To: | abuse AT demon DOT net |
| MIME-Version: | 1.0 |
| X-Newsreader: | Turnpike (32) Version 4.01 <dQumtnY$x4rJ2u5tL5fS$n2vuP> |
| Lines: | 36 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
"Parse error before string" at the INPUT line.
#include <stdio.h>
/* */
/* STRING-LENGTH of zero-terminated string... */
/* just a demo of using in-line assembler. */
/* */
int str_len(char *str){ int num=0;
asm(
"decl %ecx /n/t" /* --num */
"FIND: incl %ecx /n/t" /* ++num */
"movb [%ebx], %al /n/t" /* al = [ebx++] */
"incl %ebx /n/t"
"orb %al, %al /n/t" /* if al !=0 */
"jnz FIND /n/t" /* go round again */ |
:"c"(num) /*[OUTPUT from ECX]*/ |
:"c"(num) "b"(str) /*[INPUT to EBX,CX]*/ <=+
:"%eax" /*[JUNKED eax] */
); return num;
}
int main(){ int j; char *rope="Rhinocerus";
printf("\n\n\n\n\n\nHello-2\n");
printf("length of str was = %i\n",str_len(rope));
printf("enter a number?"); scanf("%i",&j);
return 0;
};
--
^-^-^-@@-^-;-^ http://www.xemu.demon.co.uk/
(..)__u news:alt.smoking.mooses
.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |