I have been struggling to read a certificate in windows store from C++ DLL, but its not happening. from console application I can but when same code built as a DLL and tried to access from a separate console application. I think its not going to windows store to read the cert.
The problem that I want to make an array " vertextDegree [nbColours] " with " nbColours " elements in it ,but the "nbColours" unknown and I have to get it get it from a file .
Code:
int nbEdges,nbVetices, nbColours ; typedef struct st_graphVertex { int index; int colour; int val ; int vertexDegree[nbColours]; // it won't work because nbColours unknown // here and I want get it from file in the main struct st_graphVertex *next; t_edgeList *out; }t_grapheVertex;
I have to write a loop assigning a variable x to all positions of a string variable and I'm stuck. I don't have extensive experience with arrays and I'm also a bit confused about C-String. The problem is below.
"Given the following declaration and initialization of the string variable, write a loop to assign 'X' to all positions of this string variable, keeping the length the same.
char our_string[15] = "Hi there!";
(Please note this is a 'C-string', not C++ standard string.)"
I want to open one new CMD from console application, write text into the new CMD and then coming back to the control on the old cmd. (like interactively working on the both)
look into the below code
Process P1 = Process.Start(@"C:WINDOWSsystem32cmd.exe"); P1.StartInfo.RedirectStandardInput = true; P1.StartInfo.RedirectStandardOutput = true; P1.StartInfo.UseShellExecute = false; StreamWriter wr = P1.StandardInput; wr.WriteLine("First line in New Cmd"); Console.WriteLine("First line in Old Cmd"); wr.WriteLine("Second line in New Cmd"); Console.WriteLine("Second line in Old Cmd");
it is giving the exception "StandardIn has not been redirected"
I am trying to read a tab delimited file containing 8 columns and store each element of the column as an 1-dimensional array. Though the program prints the strings correctly as in the commented printf but it doesn't give me first_col[0] value and so on. My code is as follows:
Code:
#include<stdio.h> #include<stdlib.h> #include<string.h> int main() { FILE *int_file1; int BUF = 1024;
[Code]...
The inputfile test.txt has the following elements:
Doesn't it allocate the class static variable to the heap, thus executing its algorithm then destroying it when the program ends - or. What exactly does it tell me? When the static variable is initialized, it takes place first before any of my other functions?
I have to make a program for school to evalute poker hand.I am not asking about the logic of the program,I am asking because I have to take the input from the console,five lines which can be the cards 2,3,4..10 and the problem is with J,Q,K,A ,because I dont know how to tell scanf to expect integer or char ? If I type J,Q,K,A the program crash ,
I want the user to be able to enter a command then a character, like for example: push r....I want the command to be stored in the array command, and the character to be stored in the variable c.
Now I wonder what the best way to get rid of the space is, using scanf or getchar (see below for code, only thing that I changed between the 2 versions is the statement before the comment "get rid of space")? Or maybe it doesnt matter?
Code:
include <stdio.h> #define MAX 200 void push(char c); // Puts a new element last in queue char pop(void); // Gets the first element in queue static char s[MAX]; }
I am trying to write a terminal-like chat application in Linux. I would like to use a FIFO queue to print out the messages in terminal. The queue would be populated from 2 sources- stdin and messages sent from the other user over TCP. I have meet an obstacle that I cannot handle...
Lets say I would like to take user input using fgets and put it into a buffer. Then queue it if the buffer is not empty or print if it is. The problem is that when I use fgets or scanf, my input is instantly printed to the terminal..If i do:
Code:
fgets(message, 100, stdin); printf
("%s", message The string under message is printed twice :|. Is there a way to prevent this?
I wanted to input some numbers with scanf function, i can enter some numbers and if I input -1 to the scanf, the input must end. And the scanf function has limited input, the max that I can input is 40 numbers.example if enter 1 2 4 6 5 4 -1 the scanf function will ended and the result will be appear.I wanted to know how the scanf function is like that would be best for this problem, Code: scanf("%d", &n); the result if I input those number will be like
I don't know how many numbers will be the input only that its going to be up to 10000. EOF should be active. I tried it like this:
Code:
int i = 0; int del[10000] while (scanf("%d",del[i])!=EOF) { i++; }
But it seems the value of i doesn't increment, could you provide some tips on how to scanf the inputs into an array if I don't know how many numbers will I have?
when i run it , it skips scanf and not allowing user to enter input.tried adding getchar(), fflush but nothing worked for me. //file name : sort_array_of_structure.c
Code:
/*Write a program to accept records of the different states using array of structures. The structure should contain char state, population, literacy rate, and income. Display the state whose literacy rate is highest and whose income is highest.*/
#include <stdio.h> #define M 50 struct state { char name[50]; long int population; float literacyRate; float income; }
I have created a prompt which prompts the user for an integer and I have set up a loop to check for if it is an integer or not. My "bug" is that a user can enter an "integer" and "space" and "enter" and it does not give any error and assumes that "All is FINE!". I have gotten the value from the ascii table of 'SPACE' and put it as a check in my parameter of while, but it does not work.
Here is my code:
int x, y, boolean, i; char buff[256]; printf("Enter the first integer value: "); scanf("%s", buff); i = 0; boolean = 0; //initializing our boolean var that will eventually decide if we have an error or not
I tried to scanf the input by the user into the function but it does not read my input. Read on one of the thread, it said that to scanf a input into a double, need to use %1f instead to %d (which normally used. I tried changing it to %1f and it still did not work.
Code: #include <stdio.h> #include <math.h> /* function main begins program execution */ int main( void ) { double amount; /* amount on deposit */
I'm trying to make a very simple reaction game where a random number flickers on the screen for a fraction of a second and the user has to then enter the number before another comes on the screen after a random amount of time. However I dont know how i would make it so that the user cannot enter anything after a certain amount of time has passed, below is my code?
Also FYI, clock_start is at 5100 because by the time the program actually gets to scanning in the first number the time is at an absolute minimum of 5050 milliseconds however obviously this is an impossible number to reach due to processing, my machine clocks in at 5080.
Code:
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <windows.h> int main(void){
I have created a program using a switch statement that uses scanf() to accept a users input. The input variable is defined as an integer and scanf() is also looking for an integer.
One computer I run the program and it will return a value of 0 for all non-numerical inputs such as 'z', and the output thinks the value 0 was input into scanf(). On another computer when I input 'z', the compiler stores this as 198864884, and my program executes correctly giving an error.
int i; while (scanf("%i", &i)) printf("%i ", i); printf(" done ");
i tried several combination of Ctrl+D and "Enter", it's not terminating, Ctrl+C just "cancels" the whole thing without printing "done", i'm running this on linux installed on a PC