C++ :: Creating Script File For Autocad
May 2, 2014
I want to write a visual C++ program to create a script file for Autocad. A script file has the extension .scr
The goal is, to create the file, write information in it and close the file and save it at a specific location. How can I create the file? I have tried the CreateFile function but I can not make it work. I use the Visual C++ express version as a IDE.
The question that I have is: how does the function look like? Which header files should I use and where should I put the include statement?
// PDFScripper.cpp : main project file.
#include "stdafx.h"
#include "Form1.h"
#include <Windows.h>
#include <stdio.h>
#include <tchar.h>
#include <WinBase.h>
using namespace PDFScripper;
[Code] ....
View 2 Replies
ADVERTISEMENT
May 2, 2014
i am writing a program in Microsoft Visual C++ Express. The goal is to create a Autocad script file with this program. The extension of the script file is .scr
Now I first want to create the script file, then edit is and after that save it at a specific location. I want to activate this proces with a button. I have tried many tutorials about creating files but none have worked yet. My questions are:
- How do I create the script file?
- How do I edit it?
-How do I save it?
- Where to put which code?
// PDFScripper.cpp : main project file.
#include "stdafx.h"
#include "Form1.h"
#include <Windows.h>
#include <stdio.h>
#include <tchar.h>
#include <WinBase.h>
[code].....
View 5 Replies
View Related
Jan 26, 2013
How to make a program in C to create a product inventory file containing pro0duct name, cost and quantity and then read the prouct inventory file.
View 9 Replies
View Related
Jun 20, 2013
What I am trying to do is a small program that creates accounts (User name, age,...), and stores it on a CSV file. And later I can search for a user and edit some information about him (example, his age).
Here is my code:
#include <fstream>
#include <iostream>
#include <string>
#include <stdio.h>
#include <io.h>
#include <stdlib.h>
#include <string>
Looking at the "old code" ("void searchaccountold()"), I am sure the problem is on the "while" part ("while (myfile >> name >> age >> money)").
It should work, but it doesnt. I am almost sure the problem lies on the ";"... Because the CSV uses cells, and to pass to the second cell I would normaly need an ";" and in my case I have ">>". I have tryed to change them, to use getline, etc... and didnt work.
View 5 Replies
View Related
Dec 11, 2013
I'm attempting to split a large binary file into smaller manageable files for analysis. I've written most of the software but I'm stuck in a couple of places.
1. The binary file is split by looking at a couple of bytes to determine when to create a new file or continue appending to the current new file. The question is when I need to create a new file, how can I dynamically sign it a name? My intention is to rename each subfile by: "original_name" + new section id + ".log".
2. The start of each section is determined by a specific pattern (6 bytes of FF's). I'm running into an issue where the pattern check is checking for 5 bytes instead of 6 because the for..loop doesn't increment for one instance.
I've attached the code I have so far.
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <sstream>
using namespace std;
int append_to_file(FILE *f,long sec_start, long sec_end)
[Code] ...
View 2 Replies
View Related
Apr 23, 2013
Creating a Vector Array + Reading a file ....
View 1 Replies
View Related
Jan 5, 2014
All I am trying to do is create another source file in a simple Visual Studio C++ console application.
I get the following errors:
intellisense: expected a delcaration
error C2447: "{" missing function header
I didn't create another int main () in this source file, so what is causing these errors.
View 1 Replies
View Related
Apr 28, 2015
My code compiles, but it doesn't get past this:
Here's the code:
#include <cstdlib>
#include <iostream>
#include <fstream>
using namespace std;
//ofstream random_numbers("randIntContainer.txt");
ofstream random_numbers("D:/StudentData/Documents/DataStructures/SortingAlgorithms/randIntContainer.txt");
void generateNumbers();
[Code] ....
View 9 Replies
View Related
Feb 10, 2014
So I am trying to create a program that reads a series of files and creates a graph plotting points from the file. So far my code looks a little something like this -
include <iostream>
include "ccc_x11.h"
include "ccc_shap.h"
include "ccc_win.h"
include <fstream>
using namespace std ;
int ccc_win_main() {
cwin.coord(-10, -10, 10, 10);
[Code] ....
However when I run the program nothing happens. I think it has to do with the way I set up my files, which looks a little something like this-
-9 -9 -9 -9 -9 -9 -7 -7 -6 -6 -5 -5 -4 6 3 1 -1 -3 -6 5 -5 4 -4 2 -2 0
The first thirteen numbers are the x values of the points, and the last thirteen are the y values of the points. Is there any other way to have my program read the file and display the given points?? I would use getline() however that would make my point into a string, and I dont really know how to convert a string to a double before putting the variable into a point.
View 2 Replies
View Related
Feb 10, 2015
am trying to create a service that will try to create a service that will monitor a folder. Whenever a new file gets created, I am trying to read the contents of new file and copy contents (with same file) at a new location.
The problem I am facing is that only first file that gets its name copied and a file created at a new location, but without any contents. The subsequent files do not get created at all.
My Services.cs looks like this:-
public partial class Service1 : ServiceBase
{
public Service1()
{
[Code]....
View 7 Replies
View Related
Aug 27, 2014
In the program I'm writing, I'm creating a linked list of students with individual data read from a file. At the moment, I have written two functions to accomplish this; one that creates a student node and fills it from a line file, and a second that calls on the first to create a linked list. It seems to work fine except for one thing; It seems that EOF is being reached first, but the function continues on anyways? Here is my code so far...
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct student
// Declaring student structure globally.
[Code] .....
And here is what the input file would look like...
Thui Bhu, 100, 90, 80, 100, 89, 99, 88
Ariana B. Smith, 90, 90, 100, 100, 99, 100, 95
Emily Gonzales, 100, 90, 100, 70, 78, 78, 80
Jennifer L, 80, 90, 90, 100, 89, 99, 85
Maria Jones, 65, 72, 77, 68, 62, 70, 65
Bill Gates, 60, 54, 38, 62, 65, 60, 50
Escobar Morris, 83, 77, 88, 76, 79, 72, 76
Anne Latner, 80, 80, 85, 95, 90, 95, 98
John Doe, 45, 87, 88, 89, 67, 96, 79
And here is what the output is...
EOF
EOF in create_record
Thui Bhu: 100 90 80 100 89 99 88
Ariana B. Smith: 90 90 100 100 99 100 95
Emily Gonzales: 100 90 100 70 78 78 80
Jennifer L: 80 90 90 100 89 99 85
Maria Jones: 65 72 77 68 62 70 65
Bill Gates: 60 54 38 62 65 60 50
Escobar Morris: 83 77 88 76 79 72 76
Anne Latner: 80 80 85 95 90 95 98
John Doe: 45 87 88 89 67 96 79
Press any key to continue . . .
View 2 Replies
View Related
Feb 19, 2013
How do i read a specific part of a file? I am trying to create a game that reads the prices of an object inputted by the user from a file. This is the code i have so far
#include <iostream>
#include <fstream>
using namespace std;
int main () {
ifstream infile;
infile.open ("Objects.txt", ifstream::in);
[Code] ....
The file contains this :
Example objects
( ) store items
(item) (purchase value)/(sell value)
Grocery Store Items
Fish 5 7
Vegetables 10 15
Drinks 20 30
Weapon Store Items
Pistol 300 375
Rifle 400 500
Ammunition 20 30
View 4 Replies
View Related
Jul 14, 2013
I am trying to create a loop to call in the entries from the text file named Set. The entries of Set.txtare :
1 2 3
2 4 5
and so on .. (64 such combinations)[/CODE]
It basically means the first combination for testing is 1 2 3 and next has to be 2 4 5 and so i have 64 such entries defined in set
My test files are located in D://data// and are named tst_data1 to tst_data64.
I created a loop for test set but its incorrect
Code:
// loop for test samples
char basefilename[] = "D://data//";
char , testFilen[160], numiChar[10];
for (int i=1; i<=64; i++) {
strcpy(basefilenme, "D://data//");
strcat(testfilename, Set[]);
[Code] .....
How can i call the Set .txt and how to define it.
View 1 Replies
View Related
May 11, 2013
How do you create a new directory in C++? I would like to do this using the standard library and no external, third party or non standard libraries/headers. I need to do this without calling system() or system("mkdir").
View 7 Replies
View Related
Jun 19, 2014
I have a class where I'm trying to create two static maps. I know I haven't separated the implementation from the declaration. This is how I'm required to program at the moment.
My example class that I'm trying to compile looks like this:
#include <map>
#include <string>
class Foo {
[Code]....
I keep getting compiler errors, though, saying:
invalid use of qualified-name Foo::map1
and
invalid use of qualified-name Foo::map2
I can't initialize these maps explicitly; in my real program they're created by reading in a few different files' data on startup. I need to be able to access the maps throughout my entire application, and I don't want to be required to read in the same data file over and over again.
how static maps can be created properly, or failing that explain another methodology I could use to make them available to my entire application?
View 3 Replies
View Related
Nov 6, 2014
I'm trying to create a simple program that reads in the user's first name, middle name, and last name. Then inside of the userName function, I want it to only take the first letter of firstName, first letter of middleName, and then just output the full last name. So for example: if your name was John Kevin Smith, it would output jksmith. I'm having a lot of compile issues due to the pointers. I have to use the function in this code, so the pointers are needed.
#include <stdio.h>
#include <string.h>
int main() {
char userName (char firstName[12], char middleName[12], char lastName[12], char firstInit[1], char secondInit[1]);
char firstName[12];
char middleName[12];
char lastName[12];
char firstInit[1];
[Code] ....
View 13 Replies
View Related
Jan 21, 2015
I want to create a new data type called an inf_t. It's basically infinity (which for C++ is 1.7e+308). The only reason I want this is because I want to overload the cout << operation to print out INF/inf. Should I do this in a struct?
Code: struct inf_t {
private:
double inf = 1.7e+308;
};
std::ostream& operator << (std::ostream &stream, inf_t inf) {
stream << "INF";
return stream;
}
View 4 Replies
View Related
Aug 2, 2013
I'm currently reading the C++ Guide for Dummies
Anyway right now I'm working with pointers and classes, and when I create a new pointer for my class it looks like this...
Pen *Pointerpen = new Pen;
But in the book they threw in this...
Pen *Pointerpen = new Pen();
Can you actually designate memory space for a function? Or was this a typo on their part? It's never come up before and they didn't explain it.
View 5 Replies
View Related
Apr 28, 2014
I need starting a do-while loop in my program that runs up to 10 time that asks the user to enter up to 10 scores, which include the slope and rating for the course, and calculates the handicap for each score.
Here's what I have so far:
Code:
{
//This program calculates a golfers handicap.
#include <iostream>
#include <string>
using namespace std;
[Code] ....
View 1 Replies
View Related
Nov 15, 2014
I was trying to implement own vector class and wrote some code. Below is the code.
Code: #include<iostream>
#include<vector>
using namespace std;
template <typename T> class MyVector
{
T *mem;
int m_size,final_size;
public:
MyVector() : final_size(1),m_size(4)
{
[code].....
I have question on this function.
Code: myVecPush_back(T t){}
Here I was able to put elements upto any number of time, but I have allocated memory to only 4 elements in T *mem.
My question, why the program is not crashing when I tried to put elements more that 4?
Is since the variable is of type Template? Any specific reason for this?
View 2 Replies
View Related
Mar 16, 2014
I want to build a library using c++ which will serve as an abstraction layer between applications and low-level process. The library will provide some APIs for the applications for some purposes.
For example the low-level process, may send an indication to the library i.e. raise an event, and the library in turns send it to all the applications, which have their registered callbacks to this library.
Any example for the previous scenario in c++ using boost library or the standard library will be perfect in Linux environment? The example that I want is: Generate event from a process and pass it to the library, then let an application register callback to the library.
Initially I know in Linux, I may use signal to send events, but my plan is to have a something more general not tighten to a specific OS.
View 1 Replies
View Related
Feb 22, 2015
This is what so far i did
Code:
#include <stdio.h>#include <string.h>
#include <ctype.h>
#include <bsd/string.h>
int
main(void)
[Code] ....
How to do this Using the fork(), execvp() and waitpid() system calls, launches the requested program and waits until the program has finished.
View 3 Replies
View Related
Mar 6, 2015
I am trying to create a border around my program. It looks like this: . I had to read a file in, which is in the attachment and produce the desired output in the image. I have produced the desired output, but without the border.
Here is my code thus far:
insert Code:
#include<stdio.h>
#include<Windows.h>
#define HEIGHT 21
#define WIDTH 78
int map[HEIGHT][WIDTH];
int i = 0, j = 0;
[Code] ....
View 2 Replies
View Related
Jan 11, 2014
I have recently begun programming c within my university course. I have been given a task to add arrays to a program I had previously made to make it record the values as I expect I will then quote them on an exported document.
Code:
#include <stdio.h>
#include <math.h>
main() {
int i; // step counter
float theta[10000]; // initial value for angle
[Code]....
The pendulum is meant to swing and take gravity into account, then it is meant to loop and record values for the step count, time, theta and omega (mainly theta and omega required). The boundaries are set so once the angle of theta reaches 180 degrees it then stops. I believe the problem lies in the way I have created my theta array, however, I don't properly know how to implement this. Upon launch it asks for omega, as required, after inputting the value it crashes.
View 1 Replies
View Related
Mar 6, 2015
how to make the it all work later...but in the mean time how can i get this to display this? Note it has to be made using as a console program. The "Description" and "Cost/ib" collums will be referenced through use of a header file. all else is done by user input and calculations.
View 2 Replies
View Related
Jan 27, 2015
I want to create a C library function that i can directly call in my code from any .c file having main program.following are codes...code of library function "foo.c"
Code:
#include "foo.h"
int foo(int x) /* Function definition */ {
return x + 5;
} header file "foo.h"
Code:
#ifndef FOO_H_ /* Include guard */
#define FOO_H_
int foo(int x); /* An example function declaration */
}
[code]....
to use this i have to compile the file in below manner...
Code: gcc -o my_app main.c foo.c
My concern here is that i want to compile the main.c and use function without compiling foo.c with i.e.
Code: gcc -o my_app main.c
any user of this function should only compile his program and should be able to use the function, the foo.c file should remain hidden from him
my system is Linux 2.6.18-308.4.1.el5 #1 SMP Wed Mar 28 01:54:56 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
View 9 Replies
View Related