vsscanf problem: possible BUG?

Hi guys,.

I've lived a strange effect, and if I didn't have (to be confirmed) error, a problem inside the vsscanf function and, possibly, the scanf, sscanf family...

In fact, to summarize the context, I did a few line of code to read from a file where data is written in ASCII.

10 columns, 1 will receive an integer 'index', 9 columns remaining will receive some "analog" value with 3 or 6 digits.

Here are the 3 extracted lines of the file

000007 ~ 0.000280 ~ 0.020 ~-148.535 ~ 149.590 ~ 0,124 ~ 0,180 ~ 7.671 ~ 38.356 ~ 0,170
000008 ~ 0.000320 ~ 0.020 ~-148.535 ~ 149.590 ~ 0,124 ~ 0,180 ~ 7.671 ~ 38.356 ~ 0,170
000009 ~ 0.000360 ~ 0,023 ~-148.535 ~ 149.590 ~ 0,149 ~ 0.139 ~ 7.721 ~ 38.606 ~ 0,170 (where ~ is the tank of tab: '\t')

To get a file quite easily modifiable, I kept the number of digits in the 1st field constant, to be always the same number of digits (here 6)... This is why in this case, we have 5 zeros before.

The problem is ALWAYS the same:

When I at least 1 zero 1 character of the line (for example 000008 but also 0124824 or 001542 but NOT 100020 or 106430)

AND

The 1st field include the figure: 8 or 9 and only these numbers (for example 000008 but not 000007)

THEN, my 1st converted analog value (double1 in the code) in the next argument will be to float the 1st field value:

double1 will receive 0.000280 in the analysis of the 1st line, it is normal.

double1 will receive 8.0000 and 9.0000 for the last 2 lines extracted from the file. It is NOT normal at all

Of course, it is always used of the same service, same format string, I also checked the data before the vsscanf (string Templine) and the return of the vsscanf are still 10 and that's right, the number of the parameter analyzed.

Is someone have already experienced somethings like that?

Is anyone able to reproduce this problem?

Is someone with some sort of explanation, or everything just detected a possible error in my code.

Any help is welcome

Thanks in advance.

Damien Hoyen

Now, I have used the following code:

int LineIndex;

Double double1, or 2, double3 - to - double9;

ReadLineFromFile (FileHandle,"%i\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf",&LineIndex,
& double1,
& or 2,
& double3,
& double4,

& double5,
& double6,
& double7,
& double8,

& double9};

with:

int ReadLineFromFile (int FileHandle, char * FmtStr,...)
{
 
TempLine char [1024];
int Status;
 
start multi arg
va_list args;
va_start (args, FmtStr);

Check the validity of the FmtStr
assert (FmtStr! = NULL);
  
Memset (TempLine, 0, 1024);
  
Read line
Status = ReadLine (descriptor file, TempLine, (1023));
Parse

Status = vsscanf (TempLine, FmtStr, args);
 
va_end (args);
Return (Status);
}

a catch of jr_2005.

I will be his response: using %d in the format string always a decimal number, while %i tries to find the base of the number and bed octal if it starts with 0.

(I don't have never seen anything so flawed by specifying an octal number by adding only a 0, as if people ever add a 0 to the decimal numbers... it's just another screw up in the long list of why C is one of the worst programming language ever invented.)

Tags: NI Software

Similar Questions

  • possible bug? formatting number 0 is displayed as 4 294 967 295

    This is really two questions in one. First of all, I have a routine that sometimes gives a result of 0, which is * sometimes * displayed in an AdvancedDataGrid column in the form of 4 294 967 295, which I assume is somehow a significant number (more big int?). In any case, I have one ADG with a column defined as:

    < mx:AdvancedDataGridColumn headerText = "Remaining work" labelFunction = "rem_work_fmt" textAlign = "right" / >

    The called labelFunction is illustrated below:

    private void rem_work_fmt(item:Object,_column:AdvancedDataGridColumn):String
    {
    var num:String = numberFormatter.format (item.get_remaining_work ());
    trace ("result:" + num);
    return num;
    }
    Track of exit impressions: "result: 0" as expected, but the number displayed in the grid is sometimes 0 and 4294967295 sometimes.

    More strangeness, this only happens to the last column in the ADG. I call the same logic of format on another column and have never seen a wrong result. In addition, the same 'get_remaining_work()' function is called on the same data and the result is properly displayed in a field of text as 0.

    Second question, I met a few other possible bugs, I didn't report because I found a work around. How to do that in the beta program?

    LW1001,

    Bugs can be filed in the public bug at http://bugs.adobe.com/flex/
    You will need to register before you can submit bugs.
    Also, if you can attach files to bug to the bug report, it makes it much easier for Adobe to investigate.

    Let me know if you have any other questions/problems.

    Peter

  • Are you aware of a possible bug in the version 3.6.23? In the browser, for example, "two /" appears with the slash through the 'o'. Is this a known bug? Thank you

    Are you aware of a possible bug in the version 3.6.23? In the browser, for example, "two /" appears with the slash through the 'o'. Is this a known bug?

    When the same text is seen in another browser, it is displayed correctly as "two."

    The same question is displayed on another computer.

    Thank you.

    Sounds that you use a font that supports ligatures (Palatino?).

  • K5 (snapdragon 415) Vibe Lenovo problems and bugs...

    This new form is only dedicated to all the problems and fixes for Lenovo vibe combined k5 (snapdtagon415). Please report all problems in this post. Also give the problem of bugs and suggestions for future updates.

    (1) uninstall all preinstalled applications and disable applications that can not be installed.

    (2) a lot of apps running in the background, then check all of the apps you don't want to run in the background Manager. Do carefully and do not disable the apps like WhatsApp, Facebook, etc.

    (3) disable Google use user data for Google as Google keyboard applications collection.

    (4) use a black as wallpaper background picture as it can reduce the use of heat and battery.

    (5) any suggestions more? Message using Heating_Battery message Tag.

    Note from the admin; thread locked.
    https://forums.Lenovo.com/T5/K-and-vibe-Z-series-smartphones/important-guidance-from-the-community-T...

  • possible bug in match pattern string of dot and a special character

    Hi friend recently and I find something in game chain model that it looks like bug, I want to know labveiw expert opinion on it
    the possible bug is
    have you ever tried to match (.) dot for use in regular expression? this icon could not find the point inside the string? 
    I also think what happens if we try to find a character within a string that is a piece of special character
    for example how you can use this icon to find \b inside the string as (hatef\blabview)?

    [.] to find the period

    \\B to find the backslash b

  • Possible bug: save the table with double and extended precision to the worksheet

    If one concatenates an array of double-precision and an array of precision extended with the 'build' vi table, then recorded using 'Write in a spreadsheet file' vi any digits to the right of the decimal are reset to zero in the saved file. Regardless of the entry of signifier of format (for example %.10f) to the vi 'Write in a spreadsheet file'.

    I'm on Vista Ultimate 32 bit and labview 9.0

    This is a possible bug that is easily circumvented by the conversion of a type before you incorporate arrar in a worksheet. Nevertheless, it's a bug and it cost me some time.

    Hi JL,.

    No, this is not a bug - it's a feature

    Well, if you'd look closer you would recognize the 'save to spreadsheet' as polymorphic VI. As this polymorphic VI does not support the EXTENSION numbers internally (it only supports DBL, I64, and String) LabVIEW selects the instance with more precision: I64 (I64 a 64 bits of precision, DBL that 53...). Your options are:

    -the value of the instance to use as the DBL (by right click and "Select type... »)

    -make a copy of this VI, save it under a different name and make support number of POST (not rework the polymorphic VI like you would break compatibility with other facilities of LV or future revisions)

  • Possible bug on role assignments

    I am using SOA/BPM 11.1.1.7.

    I found a possible bug when you deploy a BPM Application which mixed assignments (some directly to one user, others to a role of Application BPM (created in the workspace).

    I did two tests.

    Test 1.  Created a project/process of BPM with two lanes.  In organization, I assigned the roles of corridor users (to the embedded Weblogic LDAP).  On deployment, these roles were driven from the area space of work/Administration/roles (when logged in as a Weblogic).

    Test 2.

    In the workspace I created a few BPM roles (and put assignments users), then in a project of assigned BPM Application roles to my role of corridor.

    However, I created a corridor and made the assignment directly to the user.

    On deployment, the role which has been directly attributed to the user at the level of BPM projects has been eliminated NOT to the role area.

    A video of it is here: http://youtu.be/bWtEIRavlEY

    Stuart

    Hi Stuart,

    Could check you how your mapping roles work if you check "deployment of existing objects of update on ' option in organization.xml?

  • APEX translated application 4.2 available possible bugs on theme 25

    Hello everyone,

    I try APEX 4.2 with reactive Blue theme (theme 25). So far so good. When I tried to do an application translated from my one shot (I don't translate any string, just de-seeded and released the app), I discovered some possible bugs on the page layout. For example, in areas of form, fields with the scope of auto column cannot be aligned in the same line. They are moved to a new line, although in the original application, it works. I know it's easy to fix by setting a specific value in the scope of column. But how can I fix the page layout in the pages who are magicians (with the standard model of region) and fields are placed in the table not div like in the initial application. Is there a difference between a translated application (which is actually not yet translated) and on the initial page rendering?

    Thanks in advance.

    Hi Grandmaster,

    I think that you are hit bug 15922307 - model of presentation of the grid of a translation application is not used
    who sets us 4.2.1.00.08. Can you check if you're on this version or if you are still on APEX 4.2.0

    Concerning
    Patrick
    -----------
    Member of the APEX development team

    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • Possible bug in a Select NULL-option list

    Hi all
    I tried to use a list to select a tabular form and found a possible bug.
    I have reproduced the issue on apex.oracle.com.
    Please visit http://apex.oracle.com/pls/apex/f?p=38499:2.
    It seems that the fields for 'Display value Null' and 'return Null value are switched.
    Can someone try this and tell me if I'm doing something wrong or it's really a bug?

    Kind regards
    Moritz

    Hello

    what I saw bug # 10095760 has been filed for this issue.

    Concerning
    Patrick
    -----------
    My Blog: http://www.inside-oracle-apex.com
    APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • possible bug in class date

    I stumbled upon a possible bug in the class Date. When comparing two dates of November 20, 2007 and on November 22, 2007, I get false logic.

    public var expireDate: Date = new Date ("2007", "11", "20");
    public var todaysDate:Date = new Date();

    If (todaysDate.getTime () > = expireDate.getTime ())
    {
    this.currentState = "courseExpired";
    }
    on the other
    {
    this.currentState = 'loggedIn ';
    }

    todaysDate.getTime (returned): 1198126800000

    expireDate.getTime (returned): 1195742469234

    But whatever happens, todaysDate wins even if it shouldn't. Courses should have shown have expired.

    probably because the month is zero means the basis therefore 11 December November not :) (I know its not very obvious, but it's like that in flex and java as well).

  • Problem of alignment of rows by tabs - possible bug?

    Hi, I have lines of tabular data set of towards the top in InDesign. It seems correct in InDesign, but when I export to a PDF file, the columns are not aligned along the tabs correctly. A copy of the .indd file and an example of PDF file can be found here, if that's helpful: https://www.onlinefilefolder.com/2sHSQRSAD5YzJ4 and https://www.onlinefilefolder.com/2sguJJ05N3DXl5

    I thought it was time to do the googling myself. This problem is known, has a number of bugs and has been discussed here several times:

    http://forums.Adobe.com/message/3189398

    http://forums.Adobe.com/message/3585147

    http://forums.Adobe.com/message/3355079#3355079

    and according to http://kb2.adobe.com/cps/885/cpsid_88589.html the solution curent is to print to PDF or PS file and distill.

  • Strange problem when you set the color to several shapes at the same time. Possible bug?

    The background of a drawing or model is composed of two forms of circle and four squares. Each form has a different hue percentage, but it is actually the same shade of color.

    There are about 10 master models using the same design, just the colors are different

    If I select all six forms and hit a shade of color, then shades are always applied, but if I double click on the color chart to create a new color and then use "Preview", the shades are no longer applied and forms become a solid color. If I do the same thing without preview, she keeps the shades.

    Is this a bug?

    That's how I'd do.

    Create a Swatch at 100%

    Then select this nuance and create a "shade of Hue" - do as much tint color chart you need.

    This makes all the 'child' shades of this Swatch.

    Then when I need to change the color - with no selected object - change the shade of 100% - this makes all the other shades of colour change with grade parent '100% '.

  • Possible bug? Problem passing values

    Well, I'm under Application Express 4.1.0.00.32 on Oracle 11.2.0.1.0.

    I'm playing with some ideas for some new features in my apps and try a process simple enough form to view an interactive report and passing the three values of the column to another page through properties "link in the column" columns.

    One of the values of columns that I'm passing is "Tierra Del Fuego, both E Islas Del Atlántico Sur", but for some reason when these data are transmitted, it stops at the comma and the rest of the winds in the next past variable/column, so I lose the last column, I'm going through.

    So, I have an interactive relationship with about 84 columns. I want to move the three values in the column to a next page (as a top-down research report) and re - search the database for entries corresponding to my three values passed. But it seems that if the value that I'm passing contains a comma, then the 'value' stop at the comma and the rest of the column passed then becomes the next column values.

    Which makes sense (regarding the problem, is not how it works), and someone else can confirm that? I will continue to play even more and see if maybe I can recreate the 'problem' with other combinations of value.

    Thank you
    Bill Ferguson

    Hello

    You probably have your column field name substitution string value?
    Try will join with backslash
    >
    List of values of the element used to define the session state in a URL. Item values cannot include settlers, but may contain commas with backslashes. To change a comma in a value element, place the characters with the backslashes. For example:
    >
    As

    \#MY_COLUMN#\
    

    http://download.Oracle.com/docs/CD/E23903_01/doc/doc.41/e21674/concept_url.htm#sthref105

    Kind regards
    Jari

    Published by: jarola on 13 Sep 2011 17:56

  • Problems using collection ArrayCollection as a DataProvider for trees and the menu bar, possibly bug?

    Hi guys,.

    I'm having some troble using a collection ArrayCollection as a DataProvider for a tree and a menu bar...

    I read some Adobe documents on this subject, and I read that two components read the dataProvider in the same way.

    but my current works of DataProvider well on the tree, but not on the MenuBar component...

    My dataProvider is an ArrayCollection collection of a custom class (which extends from ArrayCollection collection), and among its assets is a children's collection: ArrayCollection, so the hierarchy can be read correctly.

    When I use the component of the tree it works, but the menu bar do not display the branches...

    Can someone help me?

    Here's the function that create my dataprovider:


    private function fnFillDP (): void {}
    for (var i: int = 0; admResult.length > i; i ++) {}
    If (.nivel JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]) == 0) {}
    var novoMenu:CL_ArrayMenu = new CL_ArrayMenu();
    novoMenu.idMenu = .idMenu JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]);
    novoMenu.titulo = .titulo JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]);
    novoMenu.parent = .parent JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]);
    novoMenu.nivel = .nivel JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]);
    novoMenu.ordem = .ordem JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]);

    dataProvider.addItem (novoMenu);
    } ElseIf (.nivel JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]) == 1) {}
    for (var j: int = 0; dataProvider.length > j; j ++) {}
    {If (CL_ArrayMenu(dataProvider[j]).idMenu == {JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]) .parent})}
    var novoMenuChildren:CL_ArrayMenu = new CL_ArrayMenu();
    novoMenuChildren.idMenu = .idMenu JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]);
    novoMenuChildren.titulo = .titulo JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]);
    novoMenuChildren.parent = .parent JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]);
    novoMenuChildren.nivel = .nivel JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]);
    novoMenuChildren.ordem = .ordem JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]);
    If (dp.length > 0) {}
    If (CL_ArrayMenu (dp.getItemAt (0)) .parent == novoMenuChildren.parent) {}
    dp.addItem (novoMenuChildren);
    } else {}
    DP = new ArrayCollection();
    dp.addItem (novoMenuChildren);
    }
    } else {}
    dp.addItem (novoMenuChildren);
    }

    CL_ArrayMenu (DataProvider [j]). Children = dp;
    break;
    }
    }
    }
    }
    tree.dataProvider = dataProvider;
    menu.dataProvider = dataProvider;
    }

    Sorry for the bad English...

    Hello

    You can try using xml as the dataprovider of the Menu bar instead of going for the Arraycollection collection.

    Thank you

    Roman

  • Possible bug in sv_Harmonic distortion and Noise.vi

    Hello

    I ran into what seems to be a bug in distortion and Noise.vi sv_Harmonic

    I call this VI into a higher level VI which is part of the box sound & Vibration tool (SVT SNR without harmonic (time) (1ch) .vi)

    What is happening is that I sometimes get error 0xFFFFB1A3 (-20061):

    Error-20061 occurred at NI_MABase.lvlibine Waveform.vi:22 > NI_MABase.lvlib:ma_Trap Fgen parameter Errors.vi:1
    frequency must be<= sampling="">

    Possible reasons:

    Analysis: The selection is not valid.

    This error is actually produced in distortion and Noise.vi sv_Harmonic by one of his subVIs (your unique information (complex) .vi svc_Extract) although I'm not able to activate debugging for this VI so I can't dig deeper.

    What seems to be the case, it is for certain fundamental frequencies that result in higher order harmonic which is located very close to Fs/2, you get the error.  I have attached a waveform and a simple VI that generates the error.  My debugging, it seems that the error occurred when the code attempts to extract the harmonic at 5119,53 Hz.  FS/2 is 5120Hz, so it must be valid, but generates an error.

    Thank you

    -mat

    Hey Matt,

    I spoke with R & D and the source of this problem is we're detects peaking at exactly the Nyquist frequency for the 127th harmonic, while it should work, we get the false error. To work around the problem, you can specify the frequency range of 0-126 harmonics as seen in the image below.  Have one less harmonic should not be a big problem as the harmonic 127th is anyway in the noise.  R & D is now aware of the issue and look forward to it.   Thank you!

Maybe you are looking for