C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 30th, 2012, 02:27 AM
schizel19 schizel19 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2012
Posts: 1 schizel19 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 37 sec
Reputation Power: 0
I cant find my parse error

[highlight]i can't run my program because o a supposed parse error... please do help me

int UpdateSong(SongInf *list, int *get, int count, int countGet)
{
int n;
SongInf temp;
char rating[10];
char answer;
FILE *input;
while(1)
{
printf("\n\nWhich entry do you want to edit?"
"\nEnter number 0 to go back to main menu");
scanf("%d",&n);
getchar();
if(n == 0)
{
return 0;
}
else if(n <= countGet)
{
printf("\nSONG INFO");
printf("\nTitle: " ,list[get[n-1]].Title);
printf("\nArtist: " ,list[get[n-1]].Artist);
printf("\nGenre: " ,list[get[n-1]].Genre);
printf("\nAlbum: " ,list[get[n-1]].Album);
printf("\nRating: " ,list[get[n-1]].Rating);
printf("\nRemarks: " ,list[get[n-1]].Remarks);
}
else
{
printf("Invalid input. Enter answer again \n");
}
}

do
{
printf("\n\nEDIT"
"\nEnter to skip field"
"\nType exit to go back to main menu"
"\nTitle: ");
if(strcmp(gets(temp.Title),"exit")==0)
{
free(get);
free(list);
return 0;
}
printf("\nArtist: ");
if(strcmp(gets(temp.Artist),"exit")==0)
{
free(get);
free(list);
return 0;
}
printf("\nGenre: ");
if(strcmp(gets(temp.Genre),"exit")==0)
{
free(get);
free(list);
return 0;
}
printf("\nAlbum: ");
if(strcmp(gets(temp.Album),"exit")==0)
{
free(get);
free(list);
return 0;
}
printf("\nRating: ");
if(strcmp(gets(rating),"exit")==0)
{
free(get);
free(list);
return 0;
}
printf("\nRemarks: ");
if(strcmp(gets(temp.Remarks),"exit")==0)
{
free(get);
free(list);
return 0;
}
if(*temp.Title != '\0')
{
strcpy(list[get[n-1]].Title,temp.Title);
}
if(*temp.Artist != '\0')
{
strcpy(list[get[n-1]].Artist,temp.Artist);
}
if(*temp.Genre != '\0')
{
strcpy(list[get[n-1]].Genre,temp.Genre);
}
if(*temp.Album != '\0')
{
strcpy(list[get[n-1]].Album,temp.Album);
}
if(*rating != '\0')
{
temp.Rating = atoi(rating);
list[get[n-1]].Rating = temp.Rating;
}
if(*temp.Remarks!= '\0')
{
strcpy(list[get[n-1]].Remarks,temp.Remarks);
}
printf("\nNEW SONG INFO");
printf("\nTitle: %s ",list[get[n-1]].Title);
printf("\nArtist: %s",list[get[n-1]].Artist);
printf("\nGenre: %s",list[get[n-1]].Genre);
printf("\nAlbum: %s",list[get[n-1]].Album);
printf("\nRating: %d",list[get[n-1]].Rating);
printf("\nRemarks: %s",list[get[n-1]].Remarks);

while(1)
{
printf("\nDo you want to save these changes? (Y)es or (N)o? ");
scanf("%c",&answer);
getchar();
if(answer == 'Y')
{
input = fopen("MProb.txt","wb");
if(fwrite(list,sizeof(SongInf),count,input) != (unsigned)count)
{
printf("\nError in updating song"
"\nPress any key to go back to main menu");
getchar();
fclose(input);
break;
}
printf("\nUpdating complete!"
"\nPress any key to go back to main menu");
getchar();
fclose(input);
break;
}
if(answer == 'N')
{
break;
}
else
{
printf("\nInvalid input. Input again!\n");
}

free(get);
free(list);
return 0;
}
}
}

Reply With Quote
  #2  
Old September 30th, 2012, 03:52 AM
bdb bdb is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2012
Posts: 156 bdb User rank is Sergeant Major (2000 - 5000 Reputation Level)bdb User rank is Sergeant Major (2000 - 5000 Reputation Level)bdb User rank is Sergeant Major (2000 - 5000 Reputation Level)bdb User rank is Sergeant Major (2000 - 5000 Reputation Level)bdb User rank is Sergeant Major (2000 - 5000 Reputation Level)bdb User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 15 h 48 m 11 sec
Reputation Power: 32
Your code would be easier to check if it were inside the code tags.
When you write code, write it between [ code ] and [ /code ] (without the spaces).

check for absence of semicolons.
check for mismatched or missing quotes or apostrophes.
check for matching of braces, and parenthesis.
check for dangling elses.

Reply With Quote
  #3  
Old September 30th, 2012, 12:41 PM
dwise1_aol's Avatar
dwise1_aol dwise1_aol is offline
Contributing User
Dev Shed God 2nd Plane (6000 - 6499 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 6,141 dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 3 Days 23 h 52 m 21 sec
Reputation Power: 1974
And if you're getting a compiler warning or error message, don't make us play a guessing game with you. Just tell us what the compiler told you. Preferably by copy-and-pasting it.

Reply With Quote
  #4  
Old September 30th, 2012, 05:47 PM
b49P23TIvg's Avatar
b49P23TIvg b49P23TIvg is offline
Contributing User
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Aug 2011
Posts: 3,389 b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 3 Days 14 h 22 m 25 sec
Reputation Power: 383
Assuming
Code:
SongInf {
  char*Title,*Artist,*Genre,*Album,*Remarks;
  int Rating
};
You have a bunch of printf statements

printf("\nTitle: " ,list[get[n-1]].Title);

where you probably should have

printf("\nTitle: %s\n" ,list[get[n-1]].Title);

In other words, the format specifier tells where to put the arguments and how to interpret them.



I suppose the big problem confronting you is that you have a "do" statement without a matching "while" .

http://msdn.microsoft.com/en-us/library/8z1ch5dd(v=vs.80).aspx
__________________
[code]Code tags[/code] are essential for python code!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > I cant find my parse error

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap