Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. PieterWinter

    Need to make non-serializable object serializable?

    Not unless you can provide "defaults" for the non serializable parts.
  2. PieterWinter

    Warning: Unreachable code at begining of swich

    Sometimes the 'case' statement is forgotten also. When using symbols instead of values, these are interpreted as labels also. switch(x) { FIRST: SECOND: THIRD: default: }
  3. PieterWinter

    Functions with strings

    The C "Integer and Floating point syntax" is nicely explained on the following page. http://www-ccs.ucsd.edu/c/syntax.html It shows a nice flow of how an integer number can be seen as a series of different characters. This can be used as the basis of your program. It also shows...
  4. PieterWinter

    Functions with strings

    Just some thoughts: Are you familiar with the isdigit() and isspace() macro's? (look at the manual page). Wouldn't it be easier to advance through the input, rather than work backwards? You need to look at what the C-constants are all about. Look at the syntax. Write a small scanner. You can...
  5. PieterWinter

    Functions with strings

    First you need to write down which format you expect. E.g. leading + or - character, followed by a series of digits (for Long conversion). For double, optionally followed by a .-symbol and (mandatory) a series of digits. You need to consider if you support numbers such as .3 For long, take one...
  6. PieterWinter

    Functions with strings

    Have you checked the standard functions strtof and strtol?
  7. PieterWinter

    type conversion

    There are a number of possibilities: if (1 == sscanf(data,"%f",&F)) conversion OK else conversion failed OR F = atof(data) or (better) F = strtod(data,&end); The strtod provides error values when the data is out of range, or just wrong. Look at the manual page for that...
  8. PieterWinter

    Strings

    int i = 10; String s = Integer.toString(i)
  9. PieterWinter

    Stuck in infinite loop

    I'm very curious to your implementation of addtoarray. I am suspecting that you are overwriting a part of your stackframe, possibly resetting either i or size or both. Tip: try to avoid testing against FALSE or TRUE: firstly, this may lead to code that looks OK, but behaves bad. Secondly, if()...
  10. PieterWinter

    extracting partial string

    You could try ${NAME%^M}xy Note that the ^M should be a "control-M", not 2 separate characters.
  11. PieterWinter

    extracting partial string

    How about fgrep "abcde:" filename | while read line do echo ${line#*:} done > results The ${line#*:} will drop everything before and including the first :
  12. PieterWinter

    Twilight zone... if (s) same as if (!s)!!!???!!!???

    Macro's can really bother you like that. I'm using a kind of code-standard for macros that you might find usefull. The thing is that it uses a different naming scheme for macros than for ordinary functions. E.g. #define M_SomeMacro(parm1,parm2,parm3) { ... } Preceeding a macro name with M_...
  13. PieterWinter

    Register Variable

    Hi fro, My example "when using address registers, their contents could be volatile also (e.g. when pointing to the data register of a serial chip", the "contents" that I referred to are not that of the register itself, but of the data it points to. Some registers of a CPU...
  14. PieterWinter

    Echo and cat together

    Hi ( echo PRODUCTION TARGETS ; echo "" ; echo "" ; cat fred ) would work also. The () is used if you want to redirect the output, e.g. ( echo 1 ; echo 2 ) > output Pieter
  15. PieterWinter

    Changing to a directory using shell

    If you start a normal program (not script) from a shell, a child process is used to run that program. If you start a script, the script is examined to figure out which (shell) program to start. Subsequently, a child process is used to run that program (could be anything from bsh, sh, to perl or...
  16. PieterWinter

    Changing to a directory using shell

    No you cannot if you're calling the script normally: your current shell would create a child-process, that would run the shell, change directory and exit. The parent process would not change directory. One way to deal with this is to invoke the script from within your own shell. E.g. ...
  17. PieterWinter

    Profiling, tracing function flow in a C++ program?

    On Solaris there's a program called 'truss', which allows you to run and follow order in which the functions are called. It's possible to enable tracing on sytem calls (default) and also on function calls in libraries and your program. It may not be what you're looking for. Perhaps there are...
  18. PieterWinter

    convert a file using awk

    Expand on: awk -F\> '{ if ( $1 == &quot;<!200&quot; ) { ct=$2 } else if ( $1 == &quot;<!210&quot; ) { cn=$2 } else if ( $1 == &quot;</$&quot; ) { print ct &quot;!&quot; cn }; }' inputfile > outputfile HTH
  19. PieterWinter

    Register Variable

    I guess that the PC (program counter) could be considered as a volatile value (i.e. it changes constantly, so when using it, the program always needs to fetch the latest value). I cannot think of any other volatile registers right now (except those with similar properties as the PC), but when...
  20. PieterWinter

    Profiling, tracing function flow in a C++ program?

    On some OS's there is the command 'cflow' which 'Generates a C and C++ flow graph of external references'. Some versions do not support C++, some do. HTH

Part and Inventory Search

Back
Top