Development of a custom binary file type? So far all I know is the just the basic structures of the binary file type, I know that structures are involved but the implementation part I have run into walls.
Below is the code for reading a struct that was stored in a binary file. Problem is while reading from file I get the name without first character and age is always equal to zero which it should not be.
I am trying to write down in binary format an array of unsigned int values but i get the following compilation error :
: In function ‘int CIndex(std::fstream&, std::fstream&, std::fstream&, std::fstream&)’: ./src/IndexBuilder/index.cpp:23:26: error: no matching function for call to ‘std::basic_fstream<char>::write(int*, long unsigned int)’ ./src/IndexBuilder/index.cpp:23:26: note: candidate is: /usr/include/c++/4.6/bits/ostream.tcc:184:5: note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::write(const _CharT*, std::streamsize) [with _CharT = char, _Traits = std::char_traits<char>, std::streamsize = long int]
This is the part the is not working:
Code: // uia is : unsigned int * uia; // then I have allocated the space for it // load it with unsigned int's // k is the number of variables in my array
o.write(uia,sizeof(unsigned int)*k); But thsi should be so simple and strait forward.... in c i do it as :
Code: fwrite(uia, sizeof(unsigned int), k , fp); but since i would need to convert fstream to FILE* i decided to do it c++ way.
I am coding in C++ an implementation of BTree Insertion. I want to display the contents of the Tree in a per-level format. After writing functions and trying to run. I get the error Undefined reference.
// C++ program for B-Tree insertion #include<iostream> using namespace std;
// A BTree node class BTreeNode{ int *keys; // An array of keys int order; // Minimum degree (defines the range for number of keys) BTreeNode **child; // An array of child pointers int size; // Current number of keys
I am running ubuntu and have tried adding -1GL to the end of my gcc compiling commands but the error says "unrecognized commandline option: 1GL". do i have to install any packages to get this to work?
Following is the program I wrote it basically takes 9 inputs and then save them into binary file. then print out the data stored in binary data and find inverse of it then print the inverse out. but its stuck in a loop somewhere.
Code: #include <stdio.h> int main() { int a[3][3],i,j; float determinant=0; int x; FILE *fp = fopen ("file.bin", "wb");
I have almost a hundred names in a text file that I want to convert to email addresses and save to another file. I seem to have it working, but it doesn't print the full names in the email prefix. The output I'm looking for is Doe_John@livebrandm, but I'm only getting D_J@livebrandm. I'm not sure what I should specifically be reading up on that applies to this directly.
I am creating small application using c#.net.I removed all image tag using regular expression no I want to remove all video file and flash file also in source code of webpage.
so far I have tried this ...
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text;
I have installed VS 2010 and VS 2012. VS 2012 uses SqlServer CE 3.5 and VS 2012 uses SqlServer CE 4.0.The problem is that when a project uses a 3.5 file it tries to open it with 4.0 even if the app.config says to use the 3.5 provider. The version of the assembly is pulled right out of the GAC. I uninstalled 4.0 and the reference auto updated its version to 3.5.1. However after installing 4.0 again it changes to 4.0. The error I am getting is that 4.0 cannot open a 3.5 file....they changed the file format from 3.5 to 4.0 and they are not compatible.
The requirement is to capture statistics of uuid occurrences for ALIVE/SEARCH/BYEBYE (it can be all 3, combinations of 2 each, or one alone) in a dynamically populated file in run time.
I am able to print all 3 combinations, but not in combination of 1 or 2 e.g.
I want to generalize the code such that uuid occurrence does not have to be all 3 (ALIVE/SEARCH/BYEBYE), the occurrences can be any combination and code should work. e.g my code gives wrong results when input.txt contains the following:
I have a multivalued function (created in some other software Mathematica) that looks like f[8.7,5.4]=4.8+8.7*I. In other words it's a complex valued function of two variables. I store the output of this function over a range of parameters in a text file that looks like:
Code:
f[1,2]=9.8+8.7I; f[4,5]=5.6-5.21I; . .
I could store it differently if that is easier, but essentially I just want some c++ code to read this in and store it, either in a vector type structure or Dictionary? (I don't think a double array will work as I don't know how long list of data is in advance).
a few pointers in building an assembler in C for a 68hc11 micro controller I'm struggling on a way to convert the assembly language in a txt file to s19 format.
My objective is to create a file and save some text in it. But the twist is that file should be created in pdf format.
I have written following code:
Code: #include<stdio.h>
Code: int main() { FILE *fp; char ch; fp=fopen("file.pdf","w"); fprintf(fp, "%PDF-1.3"); //to initiate data storage in pdf file printf(" Enter data to be stored in to the file:"); while((ch=getchar())!=EOF) putc(ch,fp); fclose(fp); return 0;}
Now my file is created in pdf format, but when I open it by double click on it, it is not open and gives the message like: "Error in opening document. This file is damaged and could not be repaired."
I'm having trouble reading my data from a .txt file into a structure of the format shown in my code. I've made my student database in the program below based on user input and I didn't have a problem with that, but now it's come to input from a file it's making it difficult.
My three tasks are:
(1) A table containing 1 row per student, containing the student ID number and all of the student's marks.
(2) Another table, containing 1 row per student, containing the student ID number and the average mark obtained by that student.
(3) The average mark for each subject.
The assumptions to be made are: The student ID can begin with a zero, and should therefore be read in as a string.The test data will contain 20 students but the program should be able to deal with up to 100 students.Assume there are no more than 4 different subjects.
So based on the first assumption I've arranged the data in the file in an order in which the student ID begins with a zero:
...for twenty students, 80 lines of data. Now, on the assumption they must be read in as strings, this is what's making it tricky to store in the structure because, I've got 80 ID numbers but 20 repeat themselves 4 times. Once I've got this data in the structure below the tasks I won't have a problem with because I can just base it on a user input program but the data's already stored instead.
Below is my code for user input associated with task (1). In this example the IDs are stored as ints but for the file they will be strings. It compiles fine, displays the data as shown in the assignment sheet, but I don't know how to get the data into my structure. I can store the data in a structure of three arrays using fscanf() no problem, but it's not very "workable" for what I need to do with it.
I am trying to make a program like a virtual machine, and therefore I need to have a virtual hard drive. I have it split across four files, each being exactly 67,108,864 bytes (at this point, the files consist of 0x00 throughout the entire file). When I try to write to the beginning of one of the files, I get a "EXC_BAD_ACCESS (code=1, address=0xff)" from Xcode.
I am trying to implement the insert function of a binary tree. Atm when I try and insert 3 nodes, the program breaks and gives me a stack overflow error. The error points to a getter function for an identifier for the data in my node class.
void LinkedList::add(Product *myProduct) { if (_length==0) { _head = new Node(NULL, NULL, myProduct); _end = _head; _length=1;
[Code] ....
Here is my insert function, the error message is
"An unhandled exception of type 'System.NullReferenceException' occurred in SDI2.exe Additional information: Object reference not set to an instance of an object. "
In my main I have declared an instance of product, "productToAdd = new Product(id,idPrice);" so I'm a bit confused as to what I need to include..