72 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for john10

Hey guys, I would like some help regarding saving or reading to or from a bin file. I've read several online tutorials about file input/output, however it doesn't given specific information when applying it to both an array of structures. My knowledge of pointers is weak, as I constantly need …

Member Avatar for jimmichaels29
0
3K
Member Avatar for munitjsr2

[CODE] #include <stdio.h> #include <stdlib.h> typedef struct filedata { char data[100]; }data_t; data_t * fname=NULL; //IS AN ARRAY OF the structure filedata REQUIRED HERE void quit() { printf("\nPress enter to exit"); fflush(stdin); getchar(); } int main() { char ch; fname=(data_t *)malloc(sizeof(data_t)); FILE *fptr=NULL; atexit(quit); printf("Please enter the file name to …

Member Avatar for AssertNull
0
3K
Member Avatar for Doogledude123

So, I've written a Custom Binary Format outline but I'm not sure how to translate it to code. I was looking for a few tips on where to get started? Here's my outline. MAPDATA { signature // U24 0x4D, 0x41, 0x50 (MAP) version // U8 0x01 width // U16 (MAX …

Member Avatar for JamesCherrill
0
828
Member Avatar for kxjakkk

I'm trying to modify this code: class Tree: def __init__(self, cargo, left=None, right=None): self.cargo = cargo self.left = left self.right = right def __str__(self): return str(self.cargo) def print_tree_inorder(tree): if tree is None: return print_tree_inorder(tree.left) print(tree.cargo, end=" ") print_tree_inorder(tree.right) So that it adds parentheses around every operator and pair of operands. …

Member Avatar for kxjakkk
0
461
Member Avatar for stephen.teacher

hi all, this is some extra credit from class we sat around cleaning up code today this is what we came up with public boolean equals2(IntTree t2){ return equals2(this.overallRoot, t2.overallRoot); } private Boolean equals2(IntTreeNode r1, IntTreeNode r2){ if(r1 == null || r2 == null){ return r1 == null && r2 …

Member Avatar for stephen.teacher
0
298
Member Avatar for prerit

Hello all!Im trying to write a program that accepts a string from users and then converts each character in the string to its corresponding 8-bit binary code and store it for further manipulation on obtained bit. I have the following code but it is not executing as expected : #include …

Member Avatar for deceptikon
0
324
Member Avatar for N1GHTS

Say I have code like this... typedef struct { unsigned A:1; unsigned B:1; } FlagStruct; extern FlagStruct *Flags; Imagine that the Flags instance is a shared resource in a multi-threaded application. Say thread #1 decides to read the value of Flags->A but thread #2 decides to set or clear Flag->B …

Member Avatar for N1GHTS
0
238
Member Avatar for Doogledude123

Alright, so I am building a Converter to convert ASCII to Binary and for some reason, the for each loop stops working when it hits a space, and I have no idea why. I'm probably just over thinking it. Extra: Can you tell me how to force the output binary …

Member Avatar for Doogledude123
0
4K
Member Avatar for Labdabeta

Hello, I have a bug in my program somewhere and I cannot understand why. The program merely prints data from a binary file. Here is the code: #include <iostream> #include <fstream> #include <vector> #include <cstdint> using namespace std; int main(int argc, char *argv[]) { if (argc!=2) { cout<<"Invalid argument count, …

Member Avatar for Labdabeta
0
409
Member Avatar for Stefan_2

This is what I have to code. Input an array of numbers(any numbers that user inputs from standard input, aka keyboard), remove numbers from array that are not 0 and 1. Thay array should now be bitwise moved with << or >> (again user choses the number of spaces moved …

Member Avatar for Stefan_2
0
285
Member Avatar for gu mi nam

this code was error.please help me fix it include <iostream> include <conio.h> include <algorithm> using namespace std; int a[]={1,5,7,4,9,8}; BST*binary_search_tree; struct BST{ int value; BST* left; BST* right; }; int search_bst(BST* node,int key){ if(node==NULL) return -1; if(key<node->value) return search_bst(node->left,key); if(key>node->value) return search_bst(node->right,key); else return node->value; } void insert_bst(BST* &treeNode,BST* newNode){ …

Member Avatar for gu mi nam
0
396
Member Avatar for Sci3nc3F1cti0n

Hey guys, this is my solution to a simple problem and I was looking for some feedback on my code. Please post any criticism you may have about it. //Test project for string to binary conversion// #include <iostream> #include <string> using namespace std; void binConvert(string ConvertMe){ int ArraySize = ConvertMe.length(); …

Member Avatar for tinstaafl
0
771
Member Avatar for nexocentric

I have an interesting problem and have searched the internet, but haven't yet found an answer. Consider the following function: function get_setting_values_from_file( $parameter ) { exec("/usr/var/binary --options $parameter", $output, $return); $settings = file( $output[0] ); } I need to unit test a similar function. I am currently using phpUnit for …

Member Avatar for nexocentric
0
951
Member Avatar for Pobunjenik

Hi, thanks for looking at this thread. :) **The goal:** I have this 2D boolean array (from my [decoder](http://www.daniweb.com/software-development/java/threads/452559/decoder-simulatorcalculator-complement-of-2-problem) thread). I managed to write a method that goes through the rows and appends a '1' or a '0' to a string based on what's in the array (1 for true, …

Member Avatar for Pobunjenik
0
363
Member Avatar for RozenKristal

I got a java test done and somehow my answer for this question is incorrect, can you guys help me explain it? So the question is: in a binary tree with height 3 the least deep leaf has depth 2 (Root has depth 0). a)Max numbers of nodes this tree …

Member Avatar for RozenKristal
0
295
Member Avatar for pucivogel

I have a script that uploads documents, it uploads them in the destination folder, but not the info about the document. Pleasa help i need this as soon as possible. No errors show. <?php $UploadDirectory = 'C:/wamp/www/agenda1/uploaddok/uploads/'; //Upload Directory, ends with slash & make sure folder exist $SuccessRedirect = 'http://localhost:8080/agenda1/index2.php'; …

Member Avatar for broj1
0
396
Member Avatar for pucivogel

can anyone show me how to upload a binary file using Ajax (and php of course) I mean the html and js ?

Member Avatar for stbuchok
0
3K
Member Avatar for fyra

Hi everyone. I'm tying to understand the instruction below. I wish someone could explain me what it means: tree->destroy(((AvlNode*)(*position)->data)->data); // destroy the left branch of the binary search tree starting from the specified node static void destroy_left(BisTree* tree, BiTreeNode* node) { BiTreeNode **position; // can't remove from an empty tree …

Member Avatar for Nutster
0
372
Member Avatar for gtkesh

Hello everybody. Here is my remove method for bst. As you all know, there are 3 cases to consider while removing a node from bst. For the last case, when a node (which is to be removed) has 2 children, I want to use predecessor instead of successor to change …

0
119
Member Avatar for nah094020

Ok so this is my task: Description: Create a generic class called GenBinTree. GenBinTree will use nodes that store a value of the generic type to store its contents. This tree will not be a search tree (no ordering of nodes by value). What ges me its the the part …

Member Avatar for Taywin
0
644
Member Avatar for de Source

hi i have an string array in which i have combinations of 0's and 1's like on index 0 i have "01", on index 1 i have "11", on index 2 i have "00", on index 3 i have"10" etc is their any possibilty that i can take these values …

Member Avatar for ddanbe
0
211
Member Avatar for somjit{}

**the code works perfectly, just i got something i dont understand...** i'v been trying to get a hold of recursion and sorting for about 3-4 days now, im getting some of it, but still not happy enough.. i searched for some good code for binary search and merge sort on …

Member Avatar for somjit{}
0
424
Member Avatar for Rishabh876

so i was trying to make a binary tree program. just inserting and deleteing. some how i messed up. i think insertion is ok till level 1 after that stays on level 1 only. also the function to delete the whole tree is not working. it only deletes node at …

Member Avatar for Rishabh876
0
314
Member Avatar for nyquist

Hi, i need to create a binary matrix (one which elements can only be 1 or 0) in openCV. The nearest that I was getting is creating a matrix which elements are 8-bit values using the CV_8UC1 dataType. There must be another dataType which specifies that the matrix elements are …

Member Avatar for vijayan121
0
6K
Member Avatar for kovacsakos

I would like to make a memory allocation: `(*matrix)[i]=(int*)malloc(sizeof(int)*sz);` But I have got an error message: Invalid operands to binary * What should be the problem?

Member Avatar for kovacsakos
0
173
Member Avatar for vikingsheepman

Hello all! I have used this forum many times in the past to solve a variety of programming related problems, but am truly stumped on a segfault within a binary search tree. I have isolated the segfault to a fscanf statement that look legitamate to me. The following code blocks …

Member Avatar for vikingsheepman
0
262
Member Avatar for trishtren

Hello, I am trying to recreate a data type in java used by adobe, it is an unsigned integer 30 bits long or U30 by the specification. Anyway i am having problems understanding the binary output, the definition states: "The variable-length encoding for u30 uses one to five bytes, depending …

Member Avatar for trishtren
0
178
Member Avatar for ThePythonNoob

Hey guys im need some help with this binary calculator, you enter the amount of bits or n in and then it calculates the number? In order for you to understand my problem more I will explain why I am making this, I asked my dad how big 128 bit …

Member Avatar for ThePythonNoob
0
241
Member Avatar for ethio
Member Avatar for trishtren

Hey, Iv been working a lot with binary files recently and i am currently stuck trying to save a string to a file. The problem is i do not want the literal string value of "010100000000000100010011000000000001000100110" to be saved to the file I want the above binary string to be …

Member Avatar for NormR1
0
1K

The End.