[Swift-user] readData is treating line as a single field

Ketan Maheshwari ketan at mcs.anl.gov
Mon Jan 13 11:01:39 CST 2014


Hi,

I am trying to use readData() function in Swift to read fields into a Swift
structure but seems it is reading the whole line as a single field.

Here is my text file for the data:

$ cat data.txt
Survey_data Strategy_data Field_data quadui_outdir
/home/kcm92/faceit-pipeline/FIXED_ACE_DOME/ACCESS1/4.5/MID/EMBU/Survey_data_import_fixed.zip
/home/kcm92/faceit-pipeline/FIXED_ACE_DOME/ACCESS1/4.5/MID/EMBU/Seasonal_strategy_fixed.zip
 /home/kcm92/faceit-pipeline/FIXED_ACE_DOME/ACCESS1/4.5/MID/EMBU/Field_Overlay_fixed.zip
/home/kcm92/outdir_1
/home/kcm92/faceit-pipeline/FIXED_ACE_DOME/ACCESS1/4.5/MID/ISHIARA/Survey_data_import_fixed.zip
/home/kcm92/faceit-pipeline/FIXED_ACE_DOME/ACCESS1/4.5/MID/ISHIARA/Seasonal_strategy_fixed.zip
/home/kcm92/faceit-pipeline/FIXED_ACE_DOME/ACCESS1/4.5/MID/ISHIARA/Field_Overlay_fixed.zip
/home/kcm92/outdir_2

I have 4 fields and 2 rows.

Here is the structure definition:

type Data{
    string Survey_data;
    string Field_data;
    string Strategy_data;
    string quadui_outdir;
}

Here is the Swift loop that I am using to process this data:

Data d[] = readData(@arg("data"));
/* run quadui */
foreach ditem in d{
tracef("Survey data is: %s", ditem.Survey_data);
}

In the output, I get the whole first row of the file instead of the
expected first field.

Any clues?

Thanks,
Ketan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-user/attachments/20140113/998bec96/attachment.html>


More information about the Swift-user mailing list