11-24-2004 09:01 AM
11-24-2004 11:09 AM
11-24-2004 12:21 PM
@C.Tommy wrote:
Hello,
i will open a .dat file in my programms.
I have different informations in my file. So, i use a token to use it seperat.
so I can use every number in my file with the own string.
This is the structure of my file:
96400116
98 4
503 309
*TASTEN
5 22
145 284 25
170 284 39
195 284 53
But I have a Problem. The first number i a line is everytime correct. "98"
But the last number in every line is not correct. "4|"
You can see the sign "|"
I think the problem ist the end of the line. But I have no \n on the end of line.
And I get this files, so I can´t do anything with the structure!!!
This is the structure of my file:
96400116
98 4
503 309
*TASTEN
5 22
145 284 25
170 284 39
195 284 53
And this ist my program part. I want compare my token with the string "*TASTEN". But I get the token velue "*TASTEN|".
So my compare result ist not correct!!!
while (!feof(input_stream)) //Solange kein End-Of-File in der Eingabe...
{
if(fgets (line, LINE_LENGHT, input_stream)) {
temptok = line;
for(i = 0; (akt_token = strtok(temptok, DELIM)) != NULL && (i < ANZ_SPALTEN); ++i) {
temptok = NULL;
if(!strcmp(akt_token, "*TASTEN")) {
g_Flag1 = 1;
}
else
{
g_Flag1 = 0;
}
and so on....
Please help me!
Thanks!!!
@C.Tommy wrote:
Hello,
i will open a .dat file in my programms.
I have different informations in my file. So, i use a token to use it seperat.
so I can use every number in my file with the own string.
This is the structure of my file:
96400116
98 4
503 309
*TASTEN
5 22
145 284 25
170 284 39
195 284 53
But I have a Problem. The first number i a line is everytime correct. "98"
But the last number in every line is not correct. "4|"
You can see the sign "|"
I think the problem ist the end of the line. But I have no \n on the end of line.
And I get this files, so I can´t do anything with the structure!!!
This is the structure of my file:
96400116
98 4
503 309
*TASTEN
5 22
145 284 25
170 284 39
195 284 53
And this ist my program part. I want compare my token with the string "*TASTEN". But I get the token velue "*TASTEN|".
So my compare result ist not correct!!!
while (!feof(input_stream)) //Solange kein End-Of-File in der Eingabe...
{
if(fgets (line, LINE_LENGHT, input_stream)) {
temptok = line;
for(i = 0; (akt_token = strtok(temptok, DELIM)) != NULL && (i < ANZ_SPALTEN); ++i) {
temptok = NULL;
if(!strcmp(akt_token, "*TASTEN")) {
g_Flag1 = 1;
}
else
{
g_Flag1 = 0;
}
and so on....
Please help me!
Thanks!!!
11-24-2004 03:44 PM