Search Results

Search found 3 results on 1 pages for 'kero'.

Page 1/1 | 1 

  • C: Proper syntax for allocating memory using pointers to pointers.

    - by ~kero-05h
    This is my first time posting here, hopefully I will not make a fool of myself. I am trying to use a function to allocate memory to a pointer, copy text to the buffer, and then change a character. I keep getting a segfault and have tried looking up the answer, my syntax is probably wrong, I could use some enlightenment. /* My objective is to pass a buffer to my Copy function, allocate room, and copy text to it. Then I want to modify the text and print it.*/ #include <stdio.h> #include <stdlib.h> #include <string.h> int Copy(char **Buffer, char *Text); int main() { char *Text = malloc(sizeof(char) * 100); char *Buffer; strncpy(Text, "1234567890\n", 100); Copy(&Buffer, Text); } int Copy(char **Buffer, char *Text) { int count; count = strlen(Text)+1; *Buffer = malloc(sizeof(char) * count); strncpy(*Buffer, Text, 5); *Buffer[2] = 'A'; /* This results in a segfault. "*Buffer[1] = 'A';" results in no differece in the output. */ printf("%s\n", *Buffer); }

    Read the article

  • Hide form if javascript disabled

    - by Kero
    I need to check on disabling JavaScript if the user disabled JavaScript from browser or firewall or any other place he will never show the form. I have lots of search and solutions, but unfortunately didn't got the right one. - Using style with no-script tag: This one could be broke with removing style... <noscript> <style type="text/css"> .HideClass { display:none; } </style> </noscript> The past code will work just fine but there is lots of problems in no-script tag as here Beside that i don't want to redirect user with no-script tag too...Beside that i can quickly stop loading the page to broke this meta or disable Meta tag from IE: <meta http-equiv="refresh" content="0; URL=Frm_JavaScriptDisable.aspx" /> Another way to redirect user with JavaScript but this will work let's say for 99% of users and this one isn't lovely way and will slow down the website... window.location="http://www.location.com/page.aspx"; Is there is any other ideas or suggestions to secure working with JavaScript...and prevent user from entering the website or see my form except when JavaScript enabled...

    Read the article

1