help with macro tween and syntax error


 
Thread Tools Search this Thread
Top Forums Programming help with macro tween and syntax error
# 1  
Old 04-05-2009
help with macro tween and syntax error

im working on a program that has to correctly add the macro TWEEN to the system (it determines
if a string falls beween two other strings in a basic sort)

im having problems doing this. here is what i got.
int main(){
char name[22];
scanf("%s",&name);
if (TWEEN("ABC", name, "XYZ")) printf("%s is between %s and %s", name,"ABC","XYZ
");
printf("%d\n",x(name,'x'));
return 0;
}

there is also a syntax error called token 'x' any hep would be appreciated. i have also already done a makefile for the program. it was required for the class.
# 2  
Old 04-05-2009
Can you post the code that shows the macro TWEEN...and is 'x' a macro too.
# 3  
Old 04-05-2009
that is all i was given and was told to add a macro TWEEN to the system. and as far as the x goes its just saying that there is an error on the line

if (TWEEN("ABC", name, "XYZ")) printf("%s is between %s and %s", name,"ABC","XYZ
");


but i cant locate the error.
# 4  
Old 04-05-2009
Well then it looks like you are the one who needs to write the macro TWEEN and 'x'...and here is a good tutorial on macros to get you started.
# 5  
Old 04-05-2009
Code:
int main(){
char name[22];
scanf("%s",&name); //this should be scanf("%s", name);
if (TWEEN("ABC", name, "XYZ")) printf("%s is between %s and %s", name,"ABC","XYZ
");
printf("%d\n",x(name,'x'));
return 0;
}

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

IF section problem. syntax error: unexpected end of file error

Hello, I have another problem with my script. Please accept my apologies, but I am really nooby in sh scripts. I am writing it for first time. My script: returned=`tail -50 SapLogs.log | grep -i "Error"` echo $returned if ; then echo "There is no errors in the logs" fi And after... (10 Replies)
Discussion started by: jedzio
10 Replies

2. UNIX for Dummies Questions & Answers

Aclocal and libtool error -- macro `AM_PROG_LIBTOOL' not found in library

The software I'm trying to install uses macros with autoconf, aclocal, libtool, autoheader, and automake. What seems to be going on is an error between libtool and aclocal. From what I understand when I run aclocal, which is in /usr/bin, it searches a different directory for the libtool.m4 which is... (0 Replies)
Discussion started by: bphqk3
0 Replies

3. Linux

Ambiguous redirect error and syntax error when using on multiple files

Hi, I need help on following linux bash script. When I linux commands for loop or while loop on individual file it runs great. but now I want the script to run on N number of files so it gives me ambiguous redirect error on line 12 and syntax error on line 22 : (pls help ); #!/bin/bash #... (16 Replies)
Discussion started by: Madhusudan Das
16 Replies

4. Shell Programming and Scripting

Receiving error: ./ang.ksh[35]: 0403-057 Syntax error at line 116 : `done' is not expected.

Hi All I am quite new to Unix. Following is a shell script that i have written and getting the subject mentioned error. #!/bin/ksh #------------------------------------------------------------------------- # File: ang_stdnld.ksh # # Desc: UNIX shell script to extract Store information.... (3 Replies)
Discussion started by: amitsinha
3 Replies

5. Programming

Make-question - redefine a macro, using another macro..?

I think there is no problem to use any macro in a new macro definishion, but I have a problem with that. I can not understand why? I have a *.mak file that inludes file with many definitions and rules. ############################################## include dstndflt.mak ... One of the... (2 Replies)
Discussion started by: alex_5161
2 Replies

6. AIX

nim mksysb error :/usr/bin/savevg[33]: 1016,07: syntax error

-------------------------------------------------------------------------------- Hello, help me please. I am trying to create a mksysb bakup using nim. I am geting this error, how to correct it ? : Command : failed stdout: yes stderr: no... (9 Replies)
Discussion started by: astjen
9 Replies

7. UNIX for Dummies Questions & Answers

awk Shell Script error : "Syntax Error : `Split' unexpected

hi there i write one awk script file in shell programing the code is related to dd/mm/yy to month, day year format but i get an error please can anybody help me out in this problem ?????? i give my code here including error awk ` # date-month -- convert mm/dd/yy to month day,... (2 Replies)
Discussion started by: Herry
2 Replies

8. Solaris

Compliation Error in solaris - macro "min" requires 2 arguments, but only 1 given

Hi, I am trying to compile our linux code base in solaris and came across the following issues. Am I suppose to do something special ? Can anyone help me to fix this issue. System : uname -a SunOS aspen 5.10 Generic_125100-08 sun4u sparc SUNW,Sun-Fire-280R The complier that I am using is... (0 Replies)
Discussion started by: learningkid
0 Replies

9. UNIX for Dummies Questions & Answers

.netrc -- macro not found error

Hi! Can you please advise if it is possible to have a .netrc file containing a login account for two different ftp servers and two diff macdef commands, and run the a specific macdef depending on the server? I have copied part of the netrc file. machine ftp1 login acct1 password... (2 Replies)
Discussion started by: edu_escandor
2 Replies
Login or Register to Ask a Question