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 TouchToneTommy 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. mrhegemon

    Problem with atoi()

    Thanks itsgsd. I can't believe I didn't think of that. BTW, It isn't necessary to cast the chars as ints, in fact I was taught casting basic datatypes is bad unless unavoidable, C/C++ handles chars as ints when doing arithmetic.
  2. mrhegemon

    About dynamic memory allocation

    Are you not allowed to use the delete[] operator on an array that was dynamically allocated in a function with new? e.g., void func1() { ... double *a; func2(a); delete[] a; ... } void func2(double *a) { ... a = new double[N]; ... } I am confused about this...
  3. mrhegemon

    Problem with atoi()

    I am having a problem with atoi() in this function. It works correctly in Windows, putting a shiftAmount that corresponds to the two digits, but fails under Linux/UNIX where, for example, a 2 and a 3 get made into 20 + 32 = 52 instead of 20 + 3 = 23. What's wrong? Is it because I declared my...
  4. mrhegemon

    Problem reading block of data from file

    I want to read a block of data from an ifstream into an array of doubles. However, the function .read(char* buffer, int size) does not allow me to put the pointer for the double array into where it requires a char pointer. I don't understand why there is this limitation, or how to get around...
  5. mrhegemon

    Problem passing array

    I am trying to pass the array "da" from the non_linear_min function to the lev_mrq_min_step function, have it filled with values, and then return it to add it into another array. The problem is, the "da" array appears to be given proper values from it's assignment in the...
  6. mrhegemon

    Passing functions as parameters

    Thank you, Salem, that was exactly what I needed.
  7. mrhegemon

    Passing functions as parameters

    I would like to be able to pass a particular function to another function so that I may call that specific function from within the function it was passed to, i.e.: double func2(int a,long b,double c); double *func1(long a,long b,*func2(...)) { ...; func2(...); ..; } How does one go...
  8. mrhegemon

    Question about Packard Bell BIOS

    I've already tried installing from the CD drive and I am sure it does not work. I obviously had to use the boot floppies and the install process is good up until it asks me where the rest of the install files are. I tell it the CD drive and it says it cannot find it. The boot floppy does NOT...
  9. mrhegemon

    Question about Packard Bell BIOS

    Nonono, what I meant is that the CD-ROM drive is not recognized until DOS starts up and loads the MSCDEX program. The CD drive is not loaded with the BIOS. Does that make sense?
  10. mrhegemon

    Question about Packard Bell BIOS

    Please don't laugh, as I know just how horrible Packard Bells are. However, I want to use my old 486 box to test UNIX and Linux on. The problem is that all of the distributions I want to install are best installed from CDs and this computer does not appear to have the ability to boot from the...
  11. mrhegemon

    Trouble passing arrays between functions.

    Wait, so, you are saying that if I malloc() the memory inside the function, I can then pass the pointer with no problem, and all I have to worry about is cleaning up with a free()? The reason I am making such a big deal is that the polyfit function returns array a with number of elements...
  12. mrhegemon

    Trouble passing arrays between functions.

    I did allocate memory for a in polyfit, I just thought that could be assumed from my pseudo-code. Don't get confused because I used a in both functions. It is a local variable. I want to create an array in an external function and return the pointer of that array so that I don't need to be...
  13. mrhegemon

    Trouble passing arrays between functions.

    The calculation has an array of coefficients as it's result. I would like to return a reference to that array, as I understand that return cannot actually return arrays, blah blah blah about pointers and stuff. I just want to be able to assign the array created in my polyfit function to the...
  14. mrhegemon

    Trouble passing arrays between functions.

    I have written a function to calculate the n-degree polynomial fit of a given data set. I made the function in an external file and linked it to another program with a header file. I want it to do something like this, where a is an array for holding the polynomial coefficients: //main program...
  15. mrhegemon

    Reading long doubles from a binary file

    Sorry, none of those suggestions helped because I finally realized that there is a utility on the computer I am programming on called "convert" and it was executing instead of my program and would not accept the arguments I gave it. I ended up using your suggestion for my original...
  16. mrhegemon

    Reading long doubles from a binary file

    Okay, I was able to get my program to correctly write the raw value of my variable to the file. I am now trying to make another program to allow me to convert the binary data file to a formatted string file just in case I would like to have the data human-readable. Unfortunately, I am getting...
  17. mrhegemon

    Writing long doubles to file

    Thank you so much, Salem. I was trying to use fwrite before but was having trouble because I was not passing the address of the variable. I know binary files are less portable, but they are better for the data analysis program I am making. Haha, and not to be mean, but you seem to be the only...
  18. mrhegemon

    Writing long doubles to file

    I would like to write the value of a long double variable to a file, but NOT in a formatted string. I want the raw 8 bytes of the number so I can keep all the precision without writing a 25-30 byte string representing the number. How is this done? Thanks for any help.
  19. mrhegemon

    Problem with simple program in NASM

    I am trying to learn how to program assembly and I am starting on a Linux system with the NASM compiler. I have written an include file for my program that contains macros for system calls, so I can make system calls more conveniently. Unfortunately, I am getting a compiler error at line 3...
  20. mrhegemon

    Problem with simple program in NASM

    I am trying to learn how to program assembly and I am starting on a Linux system with the NASM compiler. I have written an include file for my program that contains macros for system calls, so I can make system calls more conveniently. Unfortunately, I am getting a compiler error at line 3...

Part and Inventory Search

Back
Top