1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #include <stdio.h> char str; char passwd[100]; void main() { int i=0,j; printf("Enter the text now \n"); while((str=getch())!='\r') { if (str=='\b'){ // if a backspace key is used then go back printf("\b \b"); i--; } else{ passwd[i++]=str; printf("*"); // hide the password } } printf("\nFinished "); printf("\nYour password is ->"); for( j=0;j<i;j++) printf("%c",passwd[j]); getch(); } |
Java API call Example using GSON, org.json.json and Jackson [ Simple Get Call] and parsing result as JSON
import com.fasterxml.jackson.databind.JsonNode ; import com.fasterxml.jackson.databind.ObjectMapper ; import com.google.gson.* ; import org.json.JSONArray ; import org.json.JSONObject ; import java.io.* ; import java.net.HttpURLConnection ; import java.net.URL ; public class APICALL { public static void main (String[] args) throws IOException { // String url="https://mocki.io/v1/19a50724-c2e5-46a1-b457-543462cdfde2"; String url= "https://jsonplaceholder.typicode.com/users" ; String line ; StringBuilder resp= new StringBuilder() ; System. out .println(url) ; HttpURLConnection con= (HttpURLConnection) new URL(url).openConnection() ; con.setRequestMethod( "GET" ) ; con.setRequestProperty( "Accept" , "application/json" ) ; System. out .println(con.getResponseMessage()) ; System. out .println(con.getContentType()) ; InputStream inputStream=con.getInput...
Comments
Post a Comment
share your thoughts ....