Leading or trailing white space characters in file names


Re: Leading or trailing white space characters in file names
#17
As a minor point, I believe that LDView will in fact reject the sample line, but only because it has special handling of type 1 lines to determine the exact location of the filename. So if anyone tests the above and sees that LDView rejects it, that shouldn't be taken as an indication that LDView isn't broken. A similar missing white space in any other line type (2-5) will probably be ignored by LDView.

For the developers out there, the following sscanf() should succeed on Chris's sample line:

Code:
if (sscanf(line, "%d %d %f %f %f %f %f %f %f %f %f %f %f %f %s", &lineType, &colorNumber, &x, &y, &z, &a, &b, &c, &d, &e, &f, &g, &h, &i, filename) == 15)
{
    // Success!
}

(Note that it has other problems, since %s stops at the first white space character, so it wouldn't work with filenames containing spaces.)
Reply
« Next Oldest | Next Newest »



Messages In This Thread
Re: Leading or trailing white space characters in file names - by Travis Cobbs - 2011-12-16, 17:06

Forum Jump:


Users browsing this thread: 1 Guest(s)