C++ :: Parse The Root Directory Of FAT32?

Dec 27, 2013

I'm trying to parse the root directory of FAT32 in order to get a dir list in the root folder.

So I need to go over all the directory entries in the root directory and parse them.

My problem is that I don't know when to stop the iteration - How to get the size of the root directory?

I noticed that there is a byte in the boot sector - the number of the entries in the root - but in FAT32 the value is always 0, So how can i get the size of the directory?

View 1 Replies


ADVERTISEMENT

Visual C++ :: How To Set Starting Root Directory That Selects A Folder Name

Jan 22, 2013

The following code is useful to allow a user to select a particular folder in the disk directory.

Code:
void OpenFolder() {
LPMALLOC pMalloc; //,pMalloc2;
CString strDirectory;
BROWSEINFO bi;
// Gets the Shell's default allocator
wchar_t pszBuffer[MAX_PATH];

[Code] ....

However, if one uses this code over and over, one quickly becomes tired of threading one's way all the way from root directory C:. There is undoubtedly some way to designate a starting directory. The most obvious candidate to set such a target is the:

Code:
bi.pidlRoot = NULL;

But attempting to set bi.pidlRoot to a CString (directory address) errors because 'no suiitable conversion from CString to LPCITEMIDLIST exists'

How can I set the code to open at a designated address in the directory tree?

View 14 Replies View Related

C++ :: Square Root Of Number

Dec 9, 2013

i have written a function that gives me the square root of a number. Yes i know there is already a function in <cmath> that gives square roots but i thought it would be pretty challenging (and therefore fun) to try writing one on my own. I wrote my code while i was in school, listening to my Irish teacher ramble on and on about useless shit, so it's probably not the best possible way of finding the square root of a number.

double msqrt(double x) {
double adder=1;
double y = x;
for(int a=0; ; a++) {
if(y*y > x) y = y/2;
if(y*y <= x) break;

[code]....

View 6 Replies View Related

C++ :: Splaying Elements To The Root

Dec 13, 2014

I am having some difficulties splaying this element to the root.. Considering i have this splay tree .

0

1

2

3

4

What are the steps to get it 4 to the root?

View 1 Replies View Related

C++ :: BST - Any Way To Travel From A Leaf To The Root

Apr 30, 2014

Any way to travel from a leaf to the root. For example I search the tree to find the leaf i want and then trace/record the path back to the root.

View 2 Replies View Related

C++ :: BST Comparing Parents To The Root

Mar 18, 2014

Lets say for example I have a BST that is sorted by char names, using strcmp. IF greater than 0 go right else go left.

I.E (this is just an example, they are not inserted correctly)

cat
/
dog buffalo
/ /
fish mouse zebra snake

I wanted to make a copy of this BST IF the length of the nodes are greater than the root, how would I approach this? I kinda started on this but I'm not sure if I'm making this more difficult than it should be.

void BST::copygreater(node * root, node *& dest, int & holder) {
if(!root) {
dest = NULL;
return;
}

holder = strlen(root->name) + 1; //Don't know about this? If we do a recursive call then the value would change every call?

[Code] ......

View 2 Replies View Related

C++ :: Null Root Binary Tree

May 19, 2013

I got problem in binary tree code. below is my code. When i select pre, post or inorder, the .exe is not responding.. Since in my binary tree theres no roots yet.. who do i solve it? It need condition or what?

View 1 Replies View Related

C++ :: How To Parse EML File

Aug 28, 2014

I am doing a project processing emails in EML format. I searched for a library doing eml file parsing and got no hits. I really dont want to code the parser myself. I just want to get the project done with minimize cost. Which library should I use?

View 4 Replies View Related

C :: Recursion For Finding Distance Between Root And Leaf?

Jun 19, 2013

I wrote the following recursion for finding the distance between a root and a leaf, but am not quite sure how to make it work.

Code:
int calc_depth(Node* tree, Node* zero) {
if (!tree)
return 0;
if (zero->right || zero->left == tree)
return 1;
return (zero->right ? calc_depth(tree, zero->right) : calc_depth(tree, zero->left));
}

View 14 Replies View Related

C :: Program To Find The Square Root Of A Number

Dec 5, 2013

I am writing a program to find the square root of a number. I am using the Newton-Raphson method..Just to clarify a bit of the code.. fabs(1/(x+1)) < 0.001 is to check for relative error..

EXAMPLE: for user entry of 100 if the iteration process ends in 10.055 the answer will return as 10 which is correct. But it isn't doing that.

It compiles I then proceed to run it..prompts me "Enter a number to find the square root of: I type 100 then hit enter...

"The square root of 100 is -1077834936"

My first time writing a program from complete scratch.

And I know there is a sqrt() function...just wanted to write my own.

Code:

#include <stdio.h>
#include <math.h>
double mysqrt(double a);
int main()
{
double a, result;
printf("Enter a number to find the square root of: ");

[Code]...

View 1 Replies View Related

C :: Prototype Function Square Root Velocity

Mar 30, 2013

I am trying to computed the time it takes for a projectile to hit the ground. The problem is that i need to square the input of velocity before i do the calculation. the question I have is that if it's possible to have multiple arguments inside the brackets after main.

#include <stdio.h>
#include <math.h>
double distance (double a, double v, double g);
int square(int y);
double height(double v, double a, double g);
double time (double v, double a, double g);
double sqrt(double num);

[Code] ....

View 2 Replies View Related

C++ :: Finding The Root Of Equation Using Secant Method

Feb 8, 2014

I want to find the root of an equation f(x) by using the secant method [URL] .....

#include <math.h>
#include <iostream>
using namespace std;
//Define function f(x)
double f(double x, double a, double b) {
return sin((a*x)/(1+x*x))*atan(b*x)+atan(x);

[Code] ....

1) Do I have to keep the function f and RootFinderSMNew in different cpp files?

2) When compiling I get the following errors:

1>------ Build started: Project: Assignment2.1, Configuration: Debug Win32 ------
1> Find Roots Secant method.cpp

[Code] .....

What am I doing wrong ?

View 1 Replies View Related

C++ :: How To Change Hierarchy Without Passing Root Element

Aug 6, 2013

I got a mesh which has an edge with a specific transformation (translation + orientation). When this configuration / transformation is changed, its neighbours are to be updated. This structure is kept inside a tree so that when a root "frame" is passed to a method like UpdateHierachy, the mesh will recursively update itself.

If, I don't pass this method the root element, which is in my case, how do I change the rest of the structure? The reason to do this is because I want to say move the door, the windows and furniture will move along with it.

View 8 Replies View Related

C :: Parse Error / What Value Does Get Assigned

Dec 10, 2013

I get the following parsing error for the code

Code:

#include <stdio.h>

int main()
{
int i=3,4;
printf("%d",i);
return 0;
}

what is wrong with the code? I have put initialize value as 3,4 just to understand what value does i gets assigned.

View 5 Replies View Related

C++ :: Parse Value From Text File?

May 16, 2014

Suppose i have a text file with ":" as delimiter, how to i find the average value of each column? For e.g. First column will be (3+2+5)/3 and second column will be (61+87)/2 for the third column.

Sample text file
================
3:290:61:100:
2:50:
5:346:87:

I have tried using getline in while loop, but it seemed more complicated because i think it requires much more than that.

View 2 Replies View Related

C/C++ :: How To Parse CSV Data With TinyXML 2

Mar 22, 2014

I am using TinyXML 2 for the data of my RPG game, I am almost done with the tilemap parsing system, but I just couldn't figure out how to extract csv data that I have in my XML file, like this:

<data encoding="csv">
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,9,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,

[code]....

What I want to do is to extract this data using TinyXML 2 and to put the data into a 2D vector...how can I do that?

View 9 Replies View Related

C :: Function Macro For Finding Square Root Of A Number

Jul 13, 2014

How to write a function macro in C for finding the sqrt of a number?

View 2 Replies View Related

C++ :: Newton Method Program For The Square Root Of A Number

Mar 1, 2013

I have been trying to write a Newton's Method program for the square root of a number and have been failing miserably...

#include <iostream>
#include <cmath>
using namespace std;
int main() {
double x1;
double y;
double x0;

[Code] .....

View 6 Replies View Related

C++ :: How To Find The Square Root For Numerator And Denominator Separately

Apr 1, 2014

I having trouble with the rational class

here is my assignment:

Add a square root function to the rational class. Have your program print the square root of any rational number. I want to find the square root for numerator and denominator separatetly. divide the answer to get decimals and convert the decimal to fractions. i got till geting the decimal but i want to convert it back to a simplified fraction

// finding greatest common factor
int gcd(int a, int b)
{
if (b == 0)
return a;
else
return gcd(b, a % b);
}

[Code]...

View 2 Replies View Related

C++ :: Binary Search Tree (Distance From Node To Root)

Jul 28, 2014

I have my tree, and I need to find the number in the tree (given by the user) and get the distance between the node found and the root.

What I've done so far is this, but I don't think it's correct.

void BinarySearchTree::find() {
system("cls");
BinarySearchTree b;
int num;
tree_node* cur;

[Code] ....

I founded the node, but I don't know how to determine the distance.

View 3 Replies View Related

C/C++ :: Change Root Path That Application Uses To Upload File From?

Mar 12, 2013

I have an application which is used for calibration for electrical components. Here I want to set a rootpath for this application. I did some research and I found out that I can get the rootpath of the application (that is where the exe is stored) But what I am really looking for is once I start the application the root path should be what I assign. For instance currently the root path is "C:UsersPublicDocumentsABC.ToolsProjects" but I would like the root path to be "E:New ABC" Is this possible? I wrote some code where I call the exe of the application and it opens the file in a folder that I specify :

private void NewJournal_Click(object sender, EventArgs e)
{  
string filePath = @"E:New ABCabc.vnalog"
if (!File.Exists(filePath))
{
return;
}  
string SelectedFile = @"/select, " + filePath;
System.Diagnostics.Process.Start(@"E:New ABCabc.vnalog", SelectedFile);  
}  

Now this code open the .vnalog file in the application. And this works great..!!! How can I now change the path within the application?

View 1 Replies View Related

C :: Array Program - Parse Error Before INT

Sep 18, 2013

this program is just to give the size and value of the array by the user.

Code:
#include <stdio.h>
main( ) {
int size ;
scanf ( "%d", &size ) ;
int arr[size] ;
for ( i = 1 ; i <= size ; i++ ) {
scanf ( "%d", arr[i] ) ;
printf ( "%d", arr[i] ) ;
}

error : Code:
C:UsersDocumentsprog est.c:7: parse error before `int'

View 7 Replies View Related

C :: Using A Pointer To Parse Multidimensional Array

Feb 27, 2015

I have a 3-dimensional matrix(3,3,3) and want to write it to a file. I have the code for parsing it in a compatible for matlab format. But at this point i want to use a pointer to do the same thing.

Code:

#include <stdio.h>
#include <stdlib.h>
int main() {
const int dimx = 3, dimy = 3;
int i, j;
unsigned char a[3][3][3] = {

[Code]...

If it is a 1-dimensional array i can understand the logic.

Code:

int val[7] = { 11, 22, 33, 44, 55, 66, 77 } ;
int *p;
p = val[0];
for ( int i = 0 ; i <= 6 ; i++ )

[Code]...

View 3 Replies View Related

C++ :: Parse A Text File That Contains Information

Jul 31, 2014

I am trying to parse a text file that contains information and i cant seem to get started. For example, the text file looks like this:

idx=929392, pl= 12, name= someperson
age=19
state=ma
status=n/a

idx=929393, pl= 12, name= someperson2
age=20
state=ma
status=n/a

idx=929394, pl= 12, name= someperson3
age=21
state=ma
status=n/a

I want to parse the name and age into another text file like this format:

someperson 19
someperson 20
someperson 21

possibly include other attributes next to the age like idx?

View 3 Replies View Related

C++ :: Parse And Edit A Text File?

Nov 14, 2014

I have this project for school where I basically need to write a program that will take any text file and convert it into html code.

string line;
int lineCount = 0;
while (!inFile.eof()) {
getline(inFile, line);
cout << line << endl;
lineCount++;
}
cout << lineCount - 1 << " lines of text read in this file." << endl;

I have this block of code to print each line of the text file into the terminal window and count the number of lines printed. But I don't know how to make it change a single character or set of characters to something else. For example, if a line of text begins with the number "1", I want to be able to change it to "<h1>".

View 2 Replies View Related

C++ :: Using Getline To Parse From A Text File?

Nov 23, 2014

I'm trying to make a program where it reads a text file which contains "blocks" of questions like:

Type: multiple_choice
Question
Num_options: number of options
a) option1
b) option2
c) option3
d) option4
Letter of answer

and

Type: short_answer
Question
Answer text

what I'm trying to do is use parse those blocks and have it get handled by the classes, MultipleChoice and ShortAnswer.

I'm planning on using getline as a virtual function and have an if statement like
"if (string == "multiple choice)
** then get it handled by the MultipleChoice class "

View 10 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved