Having a problem printing off "None" when nothing is found!

So i have to create a program to read mp3 tags's and get infromation from the tag... If a part of the tag is empty (ex.... title) I should report this by printing out "Not found" or "None".. But i cant figure out how to get this done!

Any help/tips are greatly apperciated!

Thanks in advance, jackson!





Here is what i have..... So if title is empty i should report it.. I can't get this to work!




for (int i = 0; i<3;++i)
{
char ch;
in.get(ch);
tag[i] = ch;
}

for (int j = 0; j<3;++j)
cout <<tag[j];
cout <<endl;


for (int i = 0; i<30;++i)
{
char ch;
in.get(ch);
title[i] = ch;
}

cout << "Title: ";
for (int j = 0; j<30;++j)
{
cout <<title[j];
}
cout <<endl;

for (int i = 0; i<30;++i)
{
char ch;
in.get(ch);
artist[i] = ch;
}
cout << "Aritist: ";
for (int j = 0; j<30;++j)
{
cout <<artist[j];
}
cout <<endl;

for (int i = 0; i<30;++i)
{
char ch;
in.get(ch);
album[i] = ch;

}
cout << "Album: ";
for (int j = 0; j<30;++j)
{
cout <<album[j];
}
cout <<endl;

for (int i = 0; i<4;++i)
{
char ch;
in.get(ch);
year[i] = ch;
}
cout << "Year: ";
for (int j = 0; j<4;++j)
{
cout <<year[j];
}
cout <<endl;

for (int i = 0; i<29;++i)
{
char ch;
in.get(ch);
comment[i] = ch;
}
cout << "Comment: ";
for (int j = 0; j<29;++j)
{
cout <<comment[j];
}
cout <<endl;

for (int i = 0; i<1;++i)
{
char ch;
in.get(ch);
track[i] = ch;
}
cout << "Track: ";
for (int j = 0; j<1;++j)
{
cout <<track[j];
}
cout <<endl;
cout << "----------------------------------" << endl;

in.close();
cout << '\n';
} while( _findnext( hFile, &fd ) == 0 );
_findclose( hFile );
}

}
else
{
cout << "Please enter the right form of command" << endl;
return 0;
}
cout << "total number of files: " << count << endl;
count = 0;

Your code isn't readable, please use code tags. This is why you haven't yet any answer.
Here your readable code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
for (int i = 0; i<3;++i)
{
char ch;
in.get(ch);
tag[i] = ch;
} 

for (int j = 0; j<3;++j)
cout <<tag[j];
cout <<endl;


for (int i = 0; i<30;++i)
{
char ch;
in.get(ch);
title[i] = ch;
}

cout << "Title: ";
for (int j = 0; j<30;++j)
{
cout <<title[j]; 
}
cout <<endl;

for (int i = 0; i<30;++i)
{
char ch;
in.get(ch);
artist[i] = ch;
}
cout << "Aritist: ";
for (int j = 0; j<30;++j)
{
cout <<artist[j];
}
cout <<endl;

for (int i = 0; i<30;++i)
{
char ch;
in.get(ch);
album[i] = ch;

}
cout << "Album: ";
for (int j = 0; j<30;++j)
{
cout <<album[j];
}
cout <<endl;

for (int i = 0; i<4;++i)
{
char ch;
in.get(ch);
year[i] = ch;
}
cout << "Year: ";
for (int j = 0; j<4;++j)
{
cout <<year[j];
}
cout <<endl;

for (int i = 0; i<29;++i)
{
char ch;
in.get(ch);
comment[i] = ch;
}
cout << "Comment: ";
for (int j = 0; j<29;++j)
{
cout <<comment[j];
}
cout <<endl;

for (int i = 0; i<1;++i)
{
char ch;
in.get(ch);
track[i] = ch;
}
cout << "Track: ";
for (int j = 0; j<1;++j)
{
cout <<track[j];
}
cout <<endl;
cout << "----------------------------------" << endl;

in.close();
cout << '\n';
} while( _findnext( hFile, &fd ) == 0 );
_findclose( hFile );
}

}
else
{
cout << "Please enter the right form of command" << endl;
return 0;
}
cout << "total number of files: " << count << endl; 
count = 0;
its still not readable.. indent
Send to us complete program please, I tried to find where program start to execute by....no where :(
I can say its just like a piece...am right?
use strcmp(word, "")

By the way: Why are you reading char by char instead of in.read(title, sizeof(title))?
You could also add an extra cell (with '\0'), so you can do std::coud<<title;
Topic archived. No new replies allowed.