Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
c++ theory question
Name: BabaG Date: May 26, 2008 at 15:31:53 Pacific OS: mandriva 2007.1 CPU/Ram: p4 Product: self
Comment:
i've gotten my simple app working with lots of help from those here. many thanks for that! now i have a more theoretical question with regard to optimizing things.
i have a series of variables gathered from a text file. they are then combined into a string and fed to a system() command so they can be passed to a command line app as its parameters. [code] string app_param = variable1 + variable2 + variable3 + variable4;
system(app app_param); [/code]
right now i am combining all of the variables into the string. in some instances, though, a variable is null or has a value of 0. what is a good way of excluding these from the string? [code] string app_param = variable1 + variable4;
Name: Razor2.3 Date: May 26, 2008 at 16:16:00 Pacific
Reply:
Well, I'd probably just do something like
string app_param; if (variable1) app_param += " " + variable1;
Or something to that effect.
0
Response Number 2
Name: klint Date: May 26, 2008 at 17:31:20 Pacific
Reply:
By the way, don't be too concerned with optimization at this point: the system() call will use up far more CPU time and disk accesses than all of the string operations you do in preparing the command line.
Summary: I have a basic C++ string question. Let's say that a function reads a string of any size from a data file or user. I need the function to reduce the amount of characters in that string by 1, from the ...
Summary: I'm new to using Visual Studio w/ C++. Two questions: - I added a file to a project and now I don't want that file as part of the project. How do I remove the file from the project. Just deleting th...
Summary: In my c project there is a function alloc.c. In alloc.c the array allocbuf is initialized as an array of characters in: static char allocbuf[ALLOCSIZE]; Q1: what does the keyword static do? (not the m...