Search Results

Search found 6123 results on 245 pages for 'unsigned char'.

Page 152/245 | < Previous Page | 148 149 150 151 152 153 154 155 156 157 158 159  | Next Page >

  • writing into a file in c.

    - by mekasperasky
    i have an char array b[20] which i want to write into a file . After every iteration the value of b[20] changes , so i would like to write the string in each line of the file in each iteration . So how can i change a new line in a file and also put in a array of character?

    Read the article

  • How do I simulate a progress counter in a command line application in Python?

    - by CRP
    My Python program does a series of things and prints some diagnostic output. I would also like to have a progress counter like this: Percentage done: 25% where the number increases "in place". If I use only string statements I can write separate numbers, but that would clutter the screen. Is there some way to achieve this, for example using some escape char for backspace in order to clear a number and write the next one? Thanks

    Read the article

  • Firebird 2.1 + EXISTS = query bug?

    - by Atlas
    Using Delphi 2009 + Firebird 2.1.3. Database is ODS 11.1, default char set is UTF8. My prepared query is as follows: SELECT a.po_id, a.po_no FROM purchase_order a WHERE EXISTS (SELECT 1 FROM sales_order_item z1 JOIN purchase_order_item z2 ON z2.so_item_id = z1.so_item_id AND z2.po_id = a.po_id WHERE z1.so_id = :soid) ORDER BY a.po_no Now when I loop this say 1000 times because I have 1000 x so_id, the CPU usage get at 100% for FBSERVER.EXE Anyone encountered this problem?

    Read the article

  • Have macro 'return' a value

    - by bobobobo
    I'm using a macro and I think it works fine - #define CStrNullLastNL(str) {char* nl=strrchr(str,'\n'); if(nl){*nl=0;}} So it works to zero out the last newline in a string, really its used to chop off the linebreak when it gets left on by fgets. So, I'm wondering if I can "return" a value from the macro, so it can be called like func( CStrNullLastNL( cstr ) ) ; Or will I have to write a function

    Read the article

  • fgets equilvilant in C++

    - by mitchell
    what is the C++ equivilant to the c function fgets? I have looked at getline from ifstream, but when it comes to a end of line character, '\n', it terminates at and discards it, I am looking for a function that just terminates at the end line character but adds the end of line character to the char array. thanks in advance

    Read the article

  • standard c library for escaping a string.

    - by rampion
    Is there a standard C library function to escape C-strings? For example, if I had the C string: char example[] = "first line\nsecond line: \"inner quotes\""; And I wanted to print "first line\nsecond line: \"inner quotes\"" Is there a library function that will do that transformation for me? Rolling my own just seems a little silly. Bonus points if I can give it a length to escape (so it stops before or beyond the \0).

    Read the article

  • Is this a correct syntax (c code found on wikipedia)?

    - by m4design
    I just found this code on wikipedia. Link: http://en.wikipedia.org/wiki/Sizeof#Use The code: /* the following code illustrates the use of sizeof * with variables and expressions (no parentheses needed), * and with type names (parentheses needed) */ char c; printf("%zu,%zu", sizeof c, sizeof(int)); It states that: "The z prefix should be used to print it, because the actual size can differ on each architecture." I tried it on my compiler, but it gives the following result: 'zu,zu'

    Read the article

  • ruby sortby 3rd element in a multidimential array npot working properly

    - by Steven
    Hi, I'm using ruby to sort an array where each element in the array is another array. I have this: Data = Data.SortBy { |Info| info[3] } example data in this column: 3.1 2 5.65 -1 0.4 -9.43 -10.87 -2.3 It should sort this into: 5.65 3.1 2 0.4 -1 -2.3 -9.43 -10.87 But it comes out like this: 5.65 3.1 2 0.4 -1 -10.87 -2.3 -9.43 It's only comparing the first char of the float... not the whole number?

    Read the article

  • Better alternative for PipedReader/PipedWriter?

    - by Esko Luontola
    I need to have a buffered char stream, into which I write in one thread and from which I read in another thread. Right now I'm using PipedReader and PipedWriter for it, but those classes cause a performance problem: PipedReader does a wait(1000) when its internal buffer is empty, which causes my application to lag visibly. Would there be some library which does the same thing as PipedReader/PipedWriter, but with better performance? Or will I have to implement my own wheels?

    Read the article

  • C++ static array leading to memory leak?

    - by MDonovin
    Lets say I have something like... void foo() { char c[100]; printf("this function does nothing useful"); } When foo is called, it creates the array on the stack, and when it goes out of scope, is the memory deallocated automatically? Or is c destroyed, but the memory remains allocated, with no way to access it/get it back except restarting the computer?

    Read the article

  • Using type passed as a template in C++

    - by MeDiCS
    Is it possible to actually use the type passed as a template for control flow? I'd like to write a function that uses templates, which in turn calls another function based on the type passed: template <class T> void test_function (T var) { //Do stuff if (T == char) { bar (var); } else { foo (var); } //Do even more stuff } If not, I'll have to fallback to enums...

    Read the article

  • C++, Searching and returning value.

    - by pure841
    For example, lets say I have this string: "Name, Name2, <b>Name3</b>, Name4, <b>Name5</b>" I am trying to get whatever value / name is inside the <b> tags. So when I search the char, I get the following in an array: Name3 Name5 Any ideas? Thanks

    Read the article

  • Determine if a number is a prime with regex?

    - by kitlite
    I found the following code example for Java on RosettaCode: public static boolean prime(int n) { return !new String(new char[n]).matches(".?|(..+?)\\1+"); } I don't know Java in particular but understand all aspects of this snippet except for the regex itself I have basic to basic-advanced knowledge of Regex as you find it in the built-in PHP functions How does .?|(..+?)\\1+ match prime numbers?

    Read the article

  • Retrieving the first digit of a number

    - by Michoel
    Hi, I am just learning Java and am trying to get my program to retrieve the first digit of a number - for example 543 should return 5, etc. I thought to convert to a string, but I am not sure how I can convert it back? Thanks for any help. int number = 534; String numberString = Integer.toString(number); char firstLetterChar = numberString.charAt(0); int firstDigit = ????

    Read the article

  • Android 2.1 switch loop JRE 1.7

    - by Defuzer
    Hello how to use switch loop in my android project ? I want to use Android 2.1 I need JRE 1.7, but I want to use Android 2.1 I use loop like this: switch ((CHAR[Math.abs(intGen.nextInt()%2)])) { case "+": result = random2 + random3; break; case "-": result = random2 + random3; break; } LogCat: Cannot switch on a value of type String for source level below 1.7. Only convertible int values or enum variables are permitted

    Read the article

  • Dynamic allocation in C

    - by Kerby82
    I'm writing a program and I have the following problem: char *tmp; sprintf (tmp,"%ld",(long)time_stamp_for_file_name); Could someone explain how much memory allocate for the string tmp. How many chars are a long variable? Thank you, I would appreciate also a link to an exahustive resource on this kind of information. Thank you

    Read the article

< Previous Page | 148 149 150 151 152 153 154 155 156 157 158 159  | Next Page >