home *** CD-ROM | disk | FTP | other *** search
- Path: news.unicomp.net!rays
- From: rays@conline.com (Ray Schmalzl)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Need help with strings in SAS/C
- Date: 9 Feb 1996 04:16:05 GMT
- Organization: UniComp Technologies International Corp -- Internet Service
- Message-ID: <4fehq5$keg@news.unicomp.net>
- NNTP-Posting-Host: 204.96.7.68
- Keywords: SAS C
-
- Could somebody out there help me with strings in SAS/C? I have a few
- books on C in general, but none of them cover this quite enough. I have two
- problems. The first is getting the function atoi to work right. For example:
-
-
- #include <stdio.h>
- #include <stdlib.h>
- void main()
- {
- char CharOne, CharTwo[]="012345";
-
- CharOne = getch(); // assume typing in a digit here
-
- printf("%c\t",CharOne) ;
- printf("%i\n",atoi(CharOne)) ;
-
- printf("%c\t",CharTwo[3]) ;
- printf("%i\n",atoi (CharTwo[3]) ;
- }
-
-
- gives me an error message. the only way i can get it to work is to
- declare a third variable as in the following:
-
-
- #include <stdio.h>
- #include <stdlib.h>
- void main()
- {
- char CharOne, CharTwo[]="012345";
- char CharThree[2]="";
-
- CharOne = getch(); // assume typing in a digit here
-
- printf("%c\t",CharOne) ;
- CharThree[0]=CharOne;
- printf("%i\n",atoi(CharOne)) ;
-
- printf("%c\t",CharTwo[3]) ;
- CharThree[0]=CharTwo[3];
- printf("%i\n",atoi (CharTwo[3]) ;
- }
-
-
- Is there any way to do what I'm trying to do without declaring that extra
- variable? And what is the deal with that "ecpecting char const * found
- char" error?
-
-
- The SECOND question I have is: If I have a variable in my program like:
- char MF[]="ABCDEFG";
- how can I set up a watch in the Code Probe debugger that will display the
- array as CHARACTERS, and not as hex values??
-
- Thanks in advance,
- Ray
-
-