I've been working on this program and am finished with what I want it to accomplish. But the last step I'd like to take is to delete the linked list and free all the memory. When I free the memory the way I am right now, the program breaks. I'm not sure how I should go about freeing and setting things to NULL.
Lets say i have an array with the values 1, 5, 9, and 3. is there anyway to make this so i can have an int with the value 1593 based on those numbers in the array?
I am looking at one of the functions of an exercise:
void escape(char * s, char * t) { int i, j; i = j = 0; while ( t[i] ) { /* Translate the special character, if we have one */ switch( t[i] ) {
[code]...
Notice the while loop evaluates the current value in t to true or false. When we hit the null terminator, does that get evaluated as 0 and hence evaluates as a falsy value so the while loop exits?
I am attempting to change a character in a character array.In the code below, there are three attempts to do this. Only the first one will succeed. The last two both segfaults. If I understand correctly, str_one is declared in the heap, and could therefore be manipulated; and in contrast, str_two is declared in the stack and is therefore immutable, thus the segfault, when update it is attempted. However, I understand that using malloc, one is able to assign a pointer and allocate space in heap memory. Thus, I should be able to manipulate the assigned variable str_three. Doing so, however, results in a segfault.
Code:
#include <stdio.h> #include <stdlib.h>
int main (int argc, char const* argv[]) { char str_one[4092] = "This is string number one"; char * str_two = "This is string number two";
When you login to my site my loginservice which is done by ajax and json make a session called context.Session["Name"]. With BreakPoints it shows that everything is good and the variables are in place. However when I use Session["Name"] it comes out as null.
I will add my code at the bottem not
using System; using System.Collections.Generic; using System.Linq;
My application is processing a large amount of data (approx. 50 - 100 GB of txt data). given the machine regular user usually has, my app is writing some tmp data into a local tmp directory. and this is working just fine until users get comfortable with my software and start changing that content of local tmp dir (while the program is running). which does not give any problems like crashing a program if handled at the right time but produces wrong results in the end. now this is not my problem but i would still like to somehow restrict users from even peeking into the tmp dir. I am just tired of getting emails saying my software is cr.... (maybe it is but i don't think it is because of that)
So is it possible to somehow encrypt the entire dir so that only the program has access to it . it would be even better if the dir could look as some encrypted index file so that when user sees the warning :
I just want my program to run continuously until someone enters 0 to exit it. I tried doing while(x=1) and looping my entire block of code. Also there is a switch one is a for one is a while loop both doing the same function. I have basic error checking and whatnot.
/*This is a program that gets a user to input a starting and ending value. The code then prints the number ie 1 and 5 would be (1,2,3,4,5) and all the squares and cubes. There is a case statement asking weather you want to run it as a for or as a while loop. The choices are case sensitive. */
#include <stdio.h> #include <stdlib.h> #include <math.h>//allows for power and cube function int x; int main(){
I would like to store the entire content of a file in a single c-string variable or in a standard string class variable. Is there a function that will do this for me? I am familiar with functions that get one character or one line at a time but I don't think I've encountered a function that gets the entire file. Does this function keep or disregard the end-of-line character? If no such function exists, I would write my own function to create and return such a variable.
I am working on a drink machine simulation. I have a text file that holds the prices, names and inventory. My problem is It won't let me set my prices at 1.00 or higher. Ex: I set the price to 1.50 in the text file then when it reads the info and stores the price it only stores .50 instead of 1.50.
I am working on a drink machine simulation. I have a text file that holds the prices, names and inventory. My problem is It won't let me set my prices at 1.00 or higher. Ex: I set the price to 1.50 in the text file then when it reads the info and stores the price it only stores .50 instead of 1.50.
textfile looks like this: Apple Juice 1.50 20 Mango Juice 1.50 20 Sprite Mix 1.90 20 Coca Cola 1.90 20
I have a gridview in which I show report data, I wanted to print this data, so I added print functionality. This print functionality does not print entire gridview data, it only prints data which is visible on the screen and skip the data which is under vertical scroll bar.
Below is the print grid view code in c# for WINDOWS APPLICATION.
I am writing a program which compresses files into .zip files.
Here's my problem: Whenever I want to compress an executable file, my readFile function does not read the entire file. When I extract the .exe I get a very tiny and incomplete file.
Here's the function I use to read files:
std::string miniz_wrapper::readFile(FILE* f, int MAX_FILEBUFFER) //MAX_FILEBUFFER has a default value of 65536 { char* tmp; std::string tmp_s; int count = 0;
[Code] .....
Prior to reading, every file is opened using fopen with the mode "rb".
As you can see, the code below calculates the average, sum, number of items, etc, for a list of numbers in two separate files and compares them with one another.
e.g. we will have a text file of 10 numbers;
45 65 24 26 26 36 35 100 109 433 etc...
The problem is that the code will perform calculations on all the numbers in the txt. or csv. file. This is problematic because if there is any text in the file, e.g. headings, then the calculations will not be performed. For instance, suppose that I only wanted to include rows 5-10 in the calculations, how would I specify this in my C++ code?