C Sharp :: How To Pass Special Character To Process Argument
Mar 5, 2013
How can I pass ":" or " " as an argument to a process?
I start a process which takes an IP and port number (ex 222.240.224.131:80) as argument. Another character that I want to pass is white space character. Both of these characters cuts the argument string and sends only the part that leads them.
I'm writing a program in C that performs operations on an array of 4-byte unsigned integers. Here's some usage examples:
+ n m // print sum of elements at indexes n and m & n m // bitwise and of elements... < n m // shift element at index n by m bits
I will have to implement functions for sum, bitwise-and, bitwise-or, xor, left-shift, right-shift... All with the same function format:
void print_operation(unsigned n, unsigned m) { printf("%u ", n some_operator m); }
Is there any way that I can pass an operator as an argument so that I can have a single elegant function that looks like this? I'd really like this to work like callback functions.
void print_operation(unsigned n, unsigned m, some_type oper) { printf("%u ", oper(n, m)); }
I am trying to generate a couple of vectors, but the exact number of vectors that will be needed can only be determined at runtime. Therefore I had the idea to use a macro call and text substitution in order to declare the necessary number of vectors. Unfortunately, the arguments of a macro call are always (as far as I know) considered text only. So, the loop in my example below in which I am trying to generate the following code:
I'm using web cam to save,update the image in base directory folder.I can save the image but, while attempting to update the image..I caught an error!!
C#.Net: The process cannot access the file 'C:..~..inDebugcustomer_photos10.jpg' because it is being used by another process.
I am writing a program in which a Fucntion has to be wriiten to parse the Command Line . When I include Code for parsing in main fuction iteslf ,its run ok . But I want to make a fucntion of that code and call it from main ,than it show Segmentation error .
By using Debugging I found Some thing is mess with " -m" Parameter of Command line , But Cant Rectify it ..
Code: int main (int argc, char *argv[]){ //get_parameter_value(argc,argv); // buffer[packet_size+1]= char ("'"); while (argc > 1) { if (argv[h][0] == '-')
I've been given an assignment with the below questions.
1. What is the difference between pass by reference & pass by pointers?
2. What is the use of the initialization list in the constructor?
3. What is meant by a reference & its advantage?
4. Class has a reference, pointer and a const. Is it possible to write the copy constructor & assignment operator overloading funciton? how? ( Since reference is there, I'm not sure on how to write for it)
5. Example for a variable decleration and definition? (I know for function but for variable don kw how)
6. static and const static what is the difference??
There are many libraries in C++, but how are they made?
For example: SDL, SFML, Open CV, STK
There are no special functions in C++ from which we can create such libraries, If I wanted to create a library that processes sound signals, how would I do that? How can I access the mic, speakers and process the signals.
Open CV processes videos but which functions does it use?
I have an array in a class with some numbers in a specific order. Now I want to create a set with references to that array ordered after the arrays content. I thought a solution could be something like
class Holder { int o[10]= {1,5,7,2,3,8,4,9,6,0}; public: set<int,my_order> m_s; Holder() { for(int i=0; i<10;i++) { m_s.insert(i);
The value -1 at the end of each line does not mean anything but I need to keep it.
Finally LIST3 tells me if the points are connected counterclockwise (-1), clockwise (1), or coolinear (0).
The thing is that I want to get things as follows:
If the values of list 3=1 then I need to extract all the points in the list 1 that correspond to the value 1 in order. However the values in LIST2 cannot keep being 1, 4, 2,-1 they need to be reorganised starting by zero. Expected result in LIST2= 0,3,1,-1.
We need to do this for each value in list3 (1,-1 and 0).
The idea is to get 3 groups of values:
- Group 1 including all the values that are clockwise (list3) with the points in order in list1 and showing connections starting from zero on in list2.
- Group 2 including all the values that are counterclockwise (list3) with the points in order in list1 and showing connections starting from zero on in list2.
- Group 3 including all the values that are coolinear (list3) with the points in order in list1 and showing connections starting from zero on in list2.
The idea is to be able to print 3 files in the following way:
Exercise. 1.5 A number is special if it is divisible (no remainder) by 15. A number is big if it is greater than 999. A number is weird if it is divisible by 5 and 6 but not 18. A number is scary if it is big or weird.
Write a program to check which of the following, 450, 540, 600, and 675 are special but not scary.
Declare four variables called special, big, weird, and scary and make suitable assignments to these variables as a number is tested.
I want to do it with a function, but it just output that everything is Special and Scary, and that everything values 4199536.
Code: #include <stdio.h> #include <stdlib.h> /* Function */ int test(int); int test(int a) { int sc, sp;
I have a file that contain different content, some lines inside that file looks like that :
Time : xx:xx:xx Time : xx:xx:xx
So, I want to grab lines that start with "Time : " and put them inside a list<string> for later use. I am using windows so I don't know if the newline character is ' ' or ' ' also I don't want my grabed line contain any special character.
I have this code, but didn't work well because some special characters remain inside the string.
I am a beginner and I ALWAYS have the toughest time doing I/O files. It's extremely frustrating. It "seems" it should be so simple. The program should find a code from a list of numbers. These numbers are from 0 - 9, and after each number is a space in the file. Your job is to extract a special code containing only 10 of those numbers. For the number to be part of the code, it should be divisible by 2. After extracting 10 numbers divisible by 2 for the code, write those 10 numbers to the file to form the expected code.
Input file is ("question.txt") Output should be ("code.txt")
Should this contain a "for loop" or If/else ?
Here's what I did . .
/ // int numbers, total, counter; ifstream inFile; inFile.open ("question.txt"); outFile.open ("code.txt"); if (!inFile)
Double values are stored in text file. 23.5 36.8 34.2 ... My teacher told me to read them character by character and then make words, like i have to read "2" "3" "." "5" and now have to make it or treat it as word and then using atoi(). I have to convert it into double. but i dont know how to do this....
I have to optimize a code for below scenario. I am reading stdin (a file redirected to stdin) character by character. How many chars are going to come is not known. After every few chars there is a seaparator. e.g $ as below
rhhrkkj$hghjhdf$ddfkrjt
While reading, if the separator arrives I'm processing the string stored before that separator and then continue reading stdin in same fashion, till EOF. I am using getc(stdin) to read chars.
Using gprof I can see most of the program time is spent inside main() , for this reading logic. Rest of the program is just some insert and search operations. I am getting time of 0.01 secs at the moment, want to reduce further.