-1

I've finished a little application in c++ that parses a table of ~15k records into a .csv file.

The problem I'm having is that a third-party application that's supposed to use this file as source (Magmi) won't recognize the fields from my generated csv. However, if I simply open the same file with Open Office Calc and export it again as a .csv, it works perfectly fine with no other changes whatsoever.

I initially thought this might be a windows CR/LF issue, so I recompiled the application on linux and checked with notepad++ to make sure there's no surplus CR in there, and there isn't. All the line endings are LF.

Can someone please give me a hint as to what am I missing?

Thanks

  • 3
    Have you use a diff tool to compare the working csv, vs the broken one ? – Jarod42 Aug 09 '16 at 19:34
  • I've only compared the size of the two via their properties (the generated one is smaller by ~200 bytes) , otherwise no. As I mentioned, I'm a little perplexed by this since it's a very odd problem. – AncientGamer2k Aug 09 '16 at 19:37
  • csv is a text format, so it is easy to see difference. Do the comparison. – Jarod42 Aug 09 '16 at 19:45
  • Some things that could be different are the character encoding, a BOM, a correct EOF. If Magmi is zealous about these things and Open Office Calc isn't it could cause your issue. If i was to guess, the size difference points to character encoding. I assume you didn't specify ios::binary when writing the file? – 1stCLord Aug 09 '16 at 19:56
  • No, that was one of my derp moments I guess. Totally forgot to add it next to ios::in. Thanks for pointing that out. It didn't fix the problem, but it should have been there from the start. – AncientGamer2k Aug 09 '16 at 20:22
  • Character encoding is UTF-8 on both. The size difference from what I can tell is due to the casting done by Open Office during export. – AncientGamer2k Aug 10 '16 at 13:55
  • I've added casts and precision updates so that now the generated csv is literally identical to the exported ones you get from Open Office, yet Magmi still fails to recognize it but works with the same one created using the "save as" function from Calc. I compared the contents and sizes of the two files to see if theres a difference via notepad++, and they're identical. I'm seriously baffled by this. Anyone have any ideas? – AncientGamer2k Aug 10 '16 at 19:27
  • It turns out it was a permissions issue that was causing the problem. Since my dev. environment is set on a VM, I was copying the output file into the import folder (never really though to see if the permissions were the cause). The ownership remained with the original user the file originated from, causing it to work when it was exported from Open Office, but failing when I tried to use the original one. – AncientGamer2k Aug 10 '16 at 20:17

1 Answers1

0

It turns out it was a permissions issue that was causing the problem. Since my dev. environment is set on a VM, I was copying the output file into the import folder (never really though to see if the permissions were the cause). The ownership remained with the original user the file originated from, causing it to work when it was exported from Open Office, but failing when I tried to use the original one.

Thanks all.