C :: Configuration Tool That Edits Certain Parameters In File
Sep 15, 2014I want to make a configuration tool that edits certain parameters in my C. file. My problem is that I don't have a clue on how to start making this.
View 12 RepliesI want to make a configuration tool that edits certain parameters in my C. file. My problem is that I don't have a clue on how to start making this.
View 12 RepliesI am doing a project in C++ - a simple data base (with "one table"). I want to build that data base using a LIFO or FIFO list, but this doesn't matter here
The only problem I have is that the structure of the data base is not "locked" in the code of the program, but when the program starts, it is "loaded / implemented" from a "configuration file" called "data.txt".
So the user, before she or he runs my program opens the file "data.txt" and writes the structure of the data base that se/he wants to create. This means that one time my program can be used to create a data base of students with fields such as "name / surname / gender / age / idnumber / university" but the next time it can be used for a data base of CD's with fields like - "author / release date / no. of tracks / etc.".
How to do that "loading" of a structure of a data base from a file, when the user runs my data-base creator (my C++ program).
I am doing a project in C++ - a simple data base (with "one table").
I want to build that data base using a LIFO or FIFO list, but this doesn't matter here . The only problem I have is that the structure of the data base is not "locked" in the code of the program, but when the program starts, it is "loaded / implemented" from a "configuration file" called "data.txt".
So the user, before she or he runs my program opens the file "data.txt" and writes the structure of the data base that se/he wants to create. This means that one time my program can be used to create a data base of students with fields such as "name / surname / gender / age / idnumber / university" but the next time it can be used for a data base of CD's with fields like - "author / release date / no. of tracks / etc.".
How to do that "loading" of a structure of a data base from a file, when the user runs my data-base creator (my C++ program).
I’m developing an application where I have some defines, like:
#define PatientName “(0x0010, 0x0010)”
#define PatientId “(0x0010, 0x0020)”
#define Modality “(0x0010, 0x0030)”
And a few more (up to 3000). These defines are used to read certain fields from a DICOM image, that give information about that image (Patient Name, etc…). However I don’t wish to read all these fields. Instead I’m trying to load an .ini configuration which will configure which fields to read. For example:
[PROPERTIES]
# Fields to read
fields=PatienId,Modality
This would only retrieve the Patient Name and a Modality.
The problem is, the values I retrieve from the .ini file (reading and parsing the file with std::fstream) come as a string. How could I retrieve, for example, the defined value from PatientId, i.e. “(0x0010, 0x0020)”? Something like std::cout << # << "PatientId"; won't work.
The program adds 2 matrices that are 3x3 using arrays and then stores them into another matrix (array) and then it's edited to show a diagonal line of "0" through it, btw I'm pretty new to programming....
insert
Code:
#include <iostream>
using namespace std;
int main() {
int x[3][3],y[3][3],c[3][3],i,j;
cout<<"Enter your numbers"<<endl;
[Code] .....
It works almost just fine lol, Except that the first portion of the diagonal line does not become zero and instead displays the normal addition result.....
I am working on a script compiler that must output compiled script into binary file. Compiling etc is not a problem. The problem is detecting some specific cases. Nothing seems to work. If it works, then it breaks as soon as i modify the script.
Here is example "script1":
Code:
1VAR1 c1 = 44
2VAR2 c2 = 66
3beginscript
4if(c1=44)
5do_nothing
[Code] ....
Second example "script2", when there can be also some command between ENDIF and ENDIF. In this case: do_nothing command.
Code:
1VAR1 c1 = 44
2VAR2 c2 = 66
3beginscript
4if(c1=44)
5do_nothing
[Code] ....
The INDEXES before each line are not in actual script. They are just to point YOU to specific lines. Although the INDEXes are in compiled script!! This is very important. As you see there can be simple IF_ENDIF and nested (more complex) IF_ENDIF.
i.e IF_ENDIF inside another IF_ENDIF.
There are also IF_ELSE_ENDIF and some other ones, but im trying to make simple IF_ENDIF work first.
ENDIF is "SPECIAL" command, the IF, DO_NOTHING are "usual" commands.
"Usual" commands must always jump over(!) the ENDIF. ALWAYS!!
They must "ignore" them!
One strong RULE is like this for usual commands: always jump over any ENDIF, not matter what. If there is one, two or more ENDIF's in a row, then just jump over them to the closest NEXT usual block command. If there is some "usual" block command between multiple ENDIFs, then jump to this command and this command must therefore check whats next command right after it. And do the same: check if next command is ENDIF, if yes, jump over it, until "usual" block command is found.
This is the place im stuck. When i some time ago thinked about some ideas, i saw some patterns. One of them was that: Seems like if its nested IF_ENDIF, then every usual block command jumps out of it, i.e. right after the final ENDIF of this current nested IF_ENDIF.
But as soon as i added do_nothing between the two ENDIFs the so called "pattern" broke. In script2 above you see index 11 is do_nothing. Ok its in nested IF_ENDIF it should jump out to command index 17. But no, because there is do_nothing between index 13 and 16. If we jump out at index 11, the command 14 would never execute. This is a BIG NO. One idea i was thinking and trying was to use STL::FIND, STL::FIND_IF to find next "usual" command after specific index. But my code seems to crash sometimes and not work always.
Code:
bool NextNonENDIF(int i) {
return (i!=98);
}
int findNextBlockCmd(vector<int>&vec, int curidx)
[Code] ....
Here i pass him the vector that contains all the command TYPES in current script. Each command has its own TYPE or better called unique ID in which way compiler knows what is what. So in this case im trying to find a command thats NOT "ENDIF", in other words im trying to find next usual command after specific type of command. Lets just say the TYPE or unique ID of do_nothing is 555, im trying to find it.
How i should continue with this? What to use maybe stl::stack, some custom command indexing, some sort of labelling for usual commands in nested IF_ENDIFs or what?
In general, look script2, and i ask: There is index 11, this guy should look if there is any usual block command left for him before the final ENDIF at index 16. If there is, jump to it. If there is none, jump out of this nested IF_ENDIF to index 17.
Question: how to do it? What algorithms to use? I can use STL, BOOST, whatever. And i can use C++11.
I am using Eclipse to write C program. I download the CDT. However, I wrote the code but when I build it, I got an errors.
Make:*** No rule to make target all, Stop
I want to change my system IP, subnet mask, host name etc. using win32 VC++.
I've tried AddIPAddress function but that's not persistent.
I want to change it that it should be change without rebooting system and should be there after restarting the system.
How to open my two files with argv[1] and argv[2] as the parameters . Heres my code:
void computeCalories (const char* nutrientFileName, const char* recipeFileName) {
string file, file2;
ifstream inFile;
cout << "Please enter the nutrient file name
[Code] ....
I wrote a small program that handles configuration files. I was wondering if this code is considered "good?" I am also wondering if there are ways to optimize it.
class configFile {
std::vector<std::string> variables;
std::vector<std::string> values;
public:
/* declare the constructor function */
configFile(std::string loc) {
[Code] ....
What would be the correct way to call a function within main that has file pointer parameters?
function prototype: Code: void CalculateBoth(int num1, int num2, int*sumPtr, int *diffPtr);
I'm creating simple console application using Code::Blocks to allow me to pass parameters from other application to replace string within text/registry file before execute the registry merge. Passing parameters to console already success. Now I only have problem with reading file. Example of first line in the registry file is as below.
Windows Registry Editor Version 5.00
However when read into string and output to console using 'cout', it will be show as below with spaces in between.
W i n d o w s R e g i s t r y E d i t o r V e r s i o n 5 . 0 0
Below is my code.
ifstream f("install.reg");
string s((istreambuf_iterator<char>(f)), istreambuf_iterator<char>());
cout << s;
is there a tool to find all functions and classes in an assembly?
View 3 Replies View RelatedIs there a tool for C# that exposes coupling between objects by makeing a visual representation of the software?
View 4 Replies View RelatedIs there a profiling tool for MSVC that is free to use?
View 4 Replies View RelatedI want to create an application that automatize different applications in the sense that my application will be able to press automatically different buttons on another application.
For example: my application will start, let's say, Microsoft Office, will press some buttons in MSOffice, and will close MSOffice.
I have a project which I started. then tried to add the directx toolkit to the project referenced it but now my program wont load.
View 1 Replies View Relatedusing cs50 videos. I'm working on writing a caesar cipher program(pset2) in c using Xcode and the command line tool. So far I just press play and it compiles and runs my source code. Now I need to use command line arguments, how do I enter command line arguments with the tools I'm using?
View 1 Replies View RelatedAre there any good free or commercial software that can check the C++ code style and find any codelines that violate a given code style specification? For example, whether the codeline is indented proplery, whether the variable is using Hungarian naming notation?
View 6 Replies View RelatedI'm working with a game editor program, where the player can create their own maps. Right know I'm working with collisions, and since it's unpredictable where the player place the objects like trees, houses and cars...etc have I an idea with making a rectangle selection tool. Where the player can drag a collision box around the object, so the sprite stops when it hits the box. The problem is that I dont know how to make a tool like that. so my question is how do I create a tool like that (see picture under for more information)?
btw I'm using the SDL framework
here is a picture that illustrate the tool I want to create: [URL] ....
I am creating an application which will work as a static code analyzer after compiling my code in VS 2008 for VC++ projects. It will be a kind of code review.
how and where do I need to put my custom rule sets, and what should I do to create such a application.
Below is my Code Code snippet wher I am facing problem.
every time "pNMHDR->idFrom" is returning 0.
I even put "EnableToolTips(TRUE);" in the oninitdialog method of dialog class.
BEGIN_MESSAGE_MAP(CMyListCtrl, ListCtrl)
.
.
.
ON_NOTIFY_EX(TTN_NEEDTEXTW, 0, OnToolTipText)
ON_NOTIFY_EX(TTN_NEEDTEXTA, 0, OnToolTipText)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
[Code] .....
I am not able to get the text of a listctrl cell.
I have built the wave tool and now am trying to run my source code through it. But it just doesn't want to find the include directory. I just don't understand. Here's my command:
#include <stdio.h>
#include <vector>
#include <map>
#include <string>
Perhaps it how I built it since there is no info on how to do this? I just ran ../b2.exe from the boost_1_53_0/tools directory.
I'm running CYGWIN_NT-6.1-WOW64 TARDIS 1.7.18(0.263/5/3) 2013-04-19 10:39 i686 Cygwin with a g++ version of 4.5.3. g++ has no problem finding the default include directory (I don't have to specify the -I switch). The -I switch doesn't seem to work for any of the other include directories that I wan to use either, but I want this cleared up before I get into that since it might be related.
I was wondering if its possible to change the color of the anchor point in the transform tool.
Is this possible? Sometimes I'll move it and it takes forever to find it again on a dark image. The actual image of the cross hairs must live in the application contents somewhere? Or its made by script. After a quick search of "transform" I found this file.. Not exactly sure what I'm looking at inside but it appears to be c++ code? [URL] ....
SCREEN GRAB: [URL] ....
FILE: [URL] ....
My problem is ToolTips are not shown if any of the tool-bar menu items is disabled/inactive.
They are shown when all tool bar menus are active/enabled.
I am using TTS_ALWAYSTIP while creating Tool-Bar.
What to do to enable/display tool-tips always.
I am creating sets of list for rotational schedule. I read that to create a randomizer is by using Randomize() function. What i want to ask is how do you set the parameters? what function should i use?
for example:
1. there are three list of the same type.
2. the range are 1-100 and a-z. (can i use 1-100 instead of writing all of the range?)
3. i need seven of each range (example: 3, 42, 78, 11, 89, 64, 22, a, n, y, e, t, d, j) for each list.
4. the three list will be generated 52 times
5. (this is the hardest part) the range must be distributed equally first, before repeating the range. For example: if the number 4 is to be used again, it must wait for other number to be on the list. The same goes for the alphabet.