Search Results

Search found 4 results on 1 pages for 'blacktooth'.

Page 1/1 | 1 

  • Pointers to structures

    - by blacktooth
    typedef struct queue { int q[max]; int qhead; int qrear; } queue; void init_queue(queue *QUEUE) { QUEUE.qhead = 0; QUEUE.qrear = -1; } void enqueue(queue *QUEUE,int data) { QUEUE.qrear++; QUEUE.q[QUEUE.qrear] = data; } int process_queue(queue *QUEUE) { if(QUEUE.qhead > QUEUE.qrear) return -1; else return QUEUE.q[QUEUE.qhead++]; } I am implementing queues using arrays just to keep it simple. Wats the error with the above code?

    Read the article

  • problem parsing JSON Strings

    - by blacktooth
    var records = JSON.parse(JsonString); for(var x=0;x<records.result.length;x++) { var record = records.result[x]; ht_text+="<b><p>"+(x+1)+" " +record.EMPID+" " +record.LOCNAME+" " +record.DEPTNAME+" " +record.CUSTNAME +"<br/><br/><div class='slide'>" +record.REPORT +"</div></p></b><br/>"; } The above code works fine when the JsonString contains an array of entities but fails for single entity. result is not identified as an array! Whats wrong with it? http://pastebin.com/hgyWw5hd

    Read the article

  • Using two xmlhttprequest calls on a page

    - by blacktooth
    I have two divisions, <div id=statuslist></div><div id=customerlist></div> The function sendReq() creates a xmlhttprequest and fetches the data into the division. sendReq('statuslist','./include/util.php?do=getstatuslist','NULL'); sendReq('customerlist','emphome.php?do=getcustomerlist','NULL'); I have a problem, The data fetched into the 'customerlist' gets copied onto 'statuslist' If i change the order of function calls, sendReq('customerlist','emphome.php?do=getcustomerlist','NULL'); sendReq('statuslist','./include/util.php?do=getstatuslist','NULL'); Now the data of 'statuslist' gets into 'customerlist'.. Whats the problem with the code?

    Read the article

  • whats wrong with strcpy()

    - by blacktooth
    What is wrong with strcpy() in this code? void process_filedata(char *filename) { void* content; const char * buffer; char * temp; char * row; char * col; int lsize,buflen,tmp,num_scan; //num_scan - number of characters scanned int m=0,p=0,d=0,j=0; //m - machine, p - phase, d- delimiter, j - job FILE *file_pointer = fopen("machinetimesnew.csv","r"); if(file_pointer == NULL) { error_flag = print_error("Error opening file"); if(error_flag) exit(1); } fseek(file_pointer, 0 ,SEEK_END); lsize = ftell(file_pointer); buflen = lsize; rewind(file_pointer); // content = (char*) malloc(sizeof(char)*lsize); fread(content,1,lsize,file_pointer); buffer = (const char*) content; strcpy(temp,buffer); row = strtok(temp,"\n"); ............... ............... I am getting a segmentation fault..

    Read the article

1