Programming for software intermingling(?)

Started by
34 comments, last by lb2024 9 years, 10 months ago
This is what you need:

Well, the first thing you need to know is what the input data format looks like. The second thing is what you want the output data format to look like.

If you can specify the details of both of those, it should be pretty straightforward to write code to do the conversion automatically.


Specify what the actual job is, and we can help with implementation.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Advertisement
What I want is my program to open a file. Once that file is open, I want my program to check the file for: name, limit line, peak value, markers on peak. Once my program verifies that the file is correct it will record those numbers then create a pdf (the software my program will open can do all the above things so my program will just go through checking then using their software to create the pdf)

Now once the file is checked and made into a pdf, if possible, I want this info to populate cells in an excel sheet. This can go on for hundreds to a few thousand times.

Is that enough info? Sorry if my jargon is off.


What I want is my program to open a file. Once that file is open, I want my program to check the file for: name, limit line, peak value, markers on peak. Once my program verifies that the file is correct...

Can you show us an example of the actual file? There are a million different ways that a name could be stored in a file, and that affects how you read it back out.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Site id_cable_rl_lb

Basically all the files should have that similar file name. What I plan is creating a txt file for the cross check. So if something is missing my program will notice it and make a file stating whats missing.

I feel the hardest part will be using my program to open the software and go through a script where it will check the parameters I need. If the parameter is off I would like it to change it to the correct parameter. Once everything about the data is correct it will record the info then use the software to create a pdf.

Afterwards it would populate an excel sheet for me.

I know c and c++. I just need to know the libs for strings, and opening other files and reading and manipulating them. Then I believe with a few examples I could whip something up.

Once again thanks guys I really appreciate the feed back.

I'm more looking for details on the format of the *contents* of the file.

Is it text-based? binary? xml? key-value pairs?

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

How would I find that out? Its a very basic file of a frequency wave and a few text saved as a ".dat".

How would I find that out? Its a very basic file of a frequency wave and a few text saved as a ".dat".

Open it in a HEX editor? (or text editor if it's a text based file?) Or consult the file format spec? Swiftcoder is right. Effectively you have a data-structure, albeit one that's been serialized to disk. The structure of your data will, to a large extent, influence how relevant or applicable the advice we give will be. This returns the contents of any file as a string:

[source]

std::string loadFile(const char* filename)
{

std::string p;

std::FILE* fp = std::fopen(filename, "rb");
if(fp)

{
std::fseek(fp, 0, SEEK_END);
size_t s = std::ftell(fp);
if(s)
{

std::fseek(fp, 0, SEEK_SET);

p.resize(s);
std::fread(&p[0], 1, s, fp);

}

std::fclose(fp);
}

return p;
}

[/source]

Now, you wouldn't actually want to use that. Probably. Maybe. Possibly. Who the hell knows? Take the gamble? Phone a friend? I don't know, nor does anyone else.

To use a car analogy: The above code gives permission for a passenger to open a car door. Swiftcoder is merely asking what your passengers will find beyond that door. Will they find that the car is stationary? Will they find the ground rushing past them at 70mph? Will they find that the car has actually been compressed, in a vice, and that the doors cannot open?

How you tackle problems of this sort are 'usually' formulaic. I'm happy to step onto tarmac that isn't moving, less enthusiastic when it's moving at speed (stop first!), and would like to know whether I should keep my mobile on me, just in case someone tries to squish me in a vice.

What would I need to allow my program to open another program and run said script to automatically :check/change value, record it, make pdf...etc?
Why would you write a program that does nothing but run another program? And how does that help you solve your problem?

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

I want to do it because of the mundane practice of going through thousands of files checking the same thing over and over and then inputting slightly different values all day. If I can create a program that can do it for me it will free up my time to pursue more worthwhile things maybe even more money for me.

This topic is closed to new replies.

Advertisement