1 #include <stdio.h>
2 #include <ctype.h>
3
4 #define STR_LEN 100
5 #define LIMIT 10
6
7 int input_string(char *[],int);
8 int printf_s(char *[],int);
9 int printf_as(char *[],int);
10
11
12 int main(void)
13 {
14 char str[LIMIT][STR_LEN];
15 char *pt[LIMIT];
16 for(int j=0;j<LIMIT;j++)
17 pt[j]=str[j];
18 int tag=input_string(pt,LIMIT);
19 printf_s(pt,tag);
20 printf_as(pt,tag);
21 return 0;
22 }
23
24 int input_string(char *ps[],int num)
25 {
26 int tag=0;
27 printf("please enter %d String \n",num);
28 for(int i=0;i<num&&fgets(ps[i],STR_LEN,stdin)!=NULL&&*ps[i]!='\n';i++)
29 {
30 printf("please enter %d String \n",num-i-1);
31 tag=i+1;
32
33 }
34 return (tag? tag:0);
35 }
int printf_s(char *ps[],int num)
38 {
39 printf("printf of string:\n");
40 if(num)
41 {
42 for(int i=0;i<num;i++)
43 {
44 fputs(ps[i],stdout);
45 }
46 }
47 printf("\n");
48 }
49
50 int printf_as(char *pt[],int tag)
51 {
52 printf("printf of ascii:\n");
53 for(int i=0;i<tag;i++)
54 {
55 while(*pt[i]!='\0')
56 printf("%d",(int)toascii((int)*pt[i]++));
57 printf("\n");
58 }
59 }
4 个解决方案
#1
toascii这个函数式系统的吗?如果不是系统的,你又没定义就会报这样的错误。
#2
__toascii
Converts characters.
int __toascii( int c );
Routine Required Header Compatibility
__toascii <ctype.h> Win 95, Win NT
Converts characters.
int __toascii( int c );
Routine Required Header Compatibility
__toascii <ctype.h> Win 95, Win NT
#3
注意用法。。看看linux中是否有这个函数。。
#4
SYNOPSIS
#include <ctype.h>
DESCRIPTION
Some of the functionality described on this reference page extends the
ISO C standard. Applications shall define the appropriate feature test
macro (see the System Interfaces volume of IEEE Std 1003.1-2001, Sec-
tion 2.2, The Compilation Environment) to enable the visibility of
these symbols in this header.
The following shall be declared as functions and may also be defined as
macros. Function prototypes shall be provided.
int isalnum(int);
int isalpha(int);
int isascii(int);
int isblank(int);
int iscntrl(int);
int isdigit(int);
int isgraph(int);
int islower(int);
int isprint(int);
int ispunct(int);
int isspace(int);
int isupper(int);
int isxdigit(int);
int toascii(int);
int tolower(int);
int toupper(int);
The following are defined as macros:
int _toupper(int);
int _tolower(int);
#1
toascii这个函数式系统的吗?如果不是系统的,你又没定义就会报这样的错误。
#2
__toascii
Converts characters.
int __toascii( int c );
Routine Required Header Compatibility
__toascii <ctype.h> Win 95, Win NT
Converts characters.
int __toascii( int c );
Routine Required Header Compatibility
__toascii <ctype.h> Win 95, Win NT
#3
注意用法。。看看linux中是否有这个函数。。
#4
SYNOPSIS
#include <ctype.h>
DESCRIPTION
Some of the functionality described on this reference page extends the
ISO C standard. Applications shall define the appropriate feature test
macro (see the System Interfaces volume of IEEE Std 1003.1-2001, Sec-
tion 2.2, The Compilation Environment) to enable the visibility of
these symbols in this header.
The following shall be declared as functions and may also be defined as
macros. Function prototypes shall be provided.
int isalnum(int);
int isalpha(int);
int isascii(int);
int isblank(int);
int iscntrl(int);
int isdigit(int);
int isgraph(int);
int islower(int);
int isprint(int);
int ispunct(int);
int isspace(int);
int isupper(int);
int isxdigit(int);
int toascii(int);
int tolower(int);
int toupper(int);
The following are defined as macros:
int _toupper(int);
int _tolower(int);