If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Writing Structure to CSV file - won't work... HELP!

I need to compute some values, place them in a structure containing two vector variables, and save them in a CSV file. Right now, I can't even generate a file. I wrote the structure definition and file writing code in a header file (after first borrowing it). I have a "button" that is supposed to trigger all of the activity. I'll attach the code below:

Re: Writing Structure to CSV file - won't work... HELP!

Originally Posted by Protocol

I need to compute some values, place them in a structure containing two vector variables, and save them in a CSV file. Right now, I can't even generate a file. I wrote the structure definition and file writing code in a header file (after first borrowing it). I have a "button" that is supposed to trigger all of the activity. I'll attach the code below:

1) Use code tags when posting code. The code you posted is unformatted and practically unreadable.

Re: Writing Structure to CSV file - won't work... HELP!

1. "Code tags" - I'll try to remember that, if I can get them to work with Chrome.
2. Managed C++ is what VC++ 10 is spitting out in this case, and this is the VC++ forum.
3. No, I didn't count. I originally used the syntax you are recommending. The compiler puked and gave me either a warning or an error, listing the proper number of characters, which I then inserted.
4. I wrote the loop, because in the "final product", I'll need a loop. This is just crude, initial test code. Why waste loop time in a test of a file writing routine?
5. I'll strike the "struct" keyword and see if the software will produce the desired file. (Probably not the most likely error.)

AND

6. Formatting as integer... Does it make sense? I'm computing in billions of year increments. If it spits the results out in whole years with fractional years truncated, I didn't perceive that as a likely problem. I'll happily embrace any insights that offer an alternative approach or better reasoning.

Important: Right now this code will not write the file, and I don't understand why. I tried a Windows search for the file name after I ran this routine, and it found nothing anywhere on any drive on my computer.

Thank you! (This is normally where I go to get the answer that solves the stranger problems I encounter.)

Re: Writing Structure to CSV file - won't work... HELP!

Originally Posted by Protocol

2. Managed C++ is what VC++ 10 is spitting out in this case, and this is the VC++ forum.

You can take that attitude if you like, or you can listen to the people that have been here for years and tell you that if you're using .Net, this is the wrong forum. There is a forum especially for Managed C++, and that's where you're likely to get more help if you're writing .Net apps.

Re: Writing Structure to CSV file - won't work... HELP!

Originally Posted by Protocol

6. Formatting as integer... Does it make sense? I'm computing in billions of year increments. If it spits the results out in whole years with fractional years truncated, I didn't perceive that as a likely problem. I'll happily embrace any insights that offer an alternative approach or better reasoning.

Re: Writing Structure to CSV file - won't work... HELP!

It appears to include to exclude the decimal portion. Since I don't require the decimal portion, the integer representation is acceptable. Thanks for putting the decimal representation before me. I'd long since forgotten how to represent it.

At this point, I'll accept VC++ as VC++, including any code that it can generate. I'll leave those who assert "attitude" to reflect upon their own.

Re: Writing Structure to CSV file - won't work... HELP!

Originally Posted by Protocol

It appears to include to exclude the decimal portion. Since I don't require the decimal portion, the integer representation is acceptable. Thanks for putting the decimal representation before me. I'd long since forgotten how to represent it.

At this point, I'll accept VC++ as VC++, including any code that it can generate. I'll leave those who assert "attitude" to reflect upon their own.

Posting in the appropriate forum is for your benefit, not mine. If you're working with a particular technology, wouldn't it make more sense to post in the forum that actually discusses that technology?

* The Perfect Platform for Game Developers: Android
Developing rich, high performance Android games from the ground up is a daunting task. Intel has provided Android developers with a number of tools that can be leveraged by Android game developers.

* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.