Вы можете сделать это несколькими способами:
Наиболее очевидным решением будет запись атрибута onclick
в элементе кнопки.
или другим способом является добавление прослушивателя событий к кнопке
document.getElementById("button").addEventListener("click", function() {
alert("Button Clicked");
});
Также проверьте Ссылка jsfiddle для работы: https://jsfiddle.net/tkfbg0dw/4/
, дайте мне знать, если вам нужна помощь. Благодаря
fprintf(your_file, "\n");
This will be converted to an appropriate EOL by the stdio library on your operating system provided that you opened the file in text mode. In binary mode no conversion takes place.
From Wikipedia:
When writing a file in text mode, '\n' is transparently translated to the native newline sequence used by the system, which may be longer than one character. (Note that a C implementation is allowed not to store newline characters in files. For example, the lines of a text file could be stored as rows of a SQL table or as fixed-length records.) When reading in text mode, the native newline sequence is translated back to '\n'. In binary mode, the second mode of I/O supported by the C library, no translation is performed, and the internal representation of any escape sequence is output directly.
When you open a file in text mode (pass "w" to fopen
instead of "wb") any newline characters written to the file will automatically be converted to the appropriate newline sequence for the system. Newline sequences will be translated back to newline characters when you read the file.
This is why it's important to distinguish between text and binary mode; if you're writing in binary mode, C will not tamper with the bytes you write to a file.