Server Side Programming Articles

Page 992 of 2109

Type difference of character literals in C and C++

Akansha Kumari
Akansha Kumari
Updated on 15-Mar-2026 787 Views

Character literals are values assigned to character data type variables. They are written as single characters enclosed in single quotes (' ') like 'A', 'b' or '2'. However, the type of character literals differs between C and C++. In C, character literals are stored as type int, whereas in C++ they are stored as type char. This fundamental difference affects memory usage and type safety. Syntax 'character' // Character literal syntax Type of Character Literal in C In C, character literals have type int and occupy 4 bytes of memory. This happens ...

Read More

How to extract raw form data in Laravel?

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 15-Mar-2026 7K+ Views

In Laravel, you can extract raw form data using several methods depending on your needs. Laravel's Request class provides various methods to access form data in different formats − raw strings, arrays, or individual field values. Using file_get_contents() The file_get_contents() function with php://input returns the raw POST data as a string. This method captures the exact data sent from the form ? _token=zHuIkXpqcRqvZO4vTgxH0fFk5fCmvqSavrCjHVMi&username=testing&password=abcd Using getContent() Method The getContent() method on Laravel's Request class returns the raw request body as a string − similar to file_get_contents() but more Laravel-specific ? ...

Read More

How to get a list of registered route paths in Laravel?

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 15-Mar-2026 4K+ Views

In Laravel, you can retrieve a list of all registered route paths using several methods. All routes are stored in the routes/ folder, and you'll need to include the Route facade to work with them ? Make sure Laravel is installed and configured properly before running these examples. Using Artisan Command The simplest way to view all routes is using the artisan command ? php artisan route:list +--------+----------+---------------------+------+-------------------------------------------------------------+------------------------------------------+ | Domain | Method | URI ...

Read More

How to delete a file from the public folder in Laravel?

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 15-Mar-2026 6K+ Views

In Laravel, you can delete files from the public folder using the File facade or PHP's built-in unlink() function. The File facade provides convenient methods for file operations. To work with File facade you need to include the class as shown below − use Illuminate\Support\Facades\File; Using File::delete() Method The delete() method from the File facade can delete single files or multiple files. It accepts a file path or an array of file paths ? File deleted successfully Using PHP unlink() Function The unlink() function is ...

Read More

Line Splicing in C/C++

Revathi Satya Kondra
Revathi Satya Kondra
Updated on 15-Mar-2026 802 Views

In C programming, line splicing is a preprocessor feature that allows you to split one long line of code into multiple lines by using a backslash (\) at the end of a line. The backslash tells the preprocessor to treat the next line as a continuation of the current line. Line splicing is processed before compilation during the preprocessing phase. It does not have parameters or return values − it simply affects how lines of code are interpreted by joining them together. Syntax line_of_code \ continuation_of_line The backslash must be the last character on ...

Read More

How to pass an array as a URL parameter in Laravel?

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 15-Mar-2026 12K+ Views

In Laravel, you can pass arrays as URL parameters using several PHP built-in functions. This is useful when you need to send structured data through URLs for API calls or redirects. Using http_build_query() The http_build_query() function converts an array into a URL-encoded query string, making it the most common approach for passing arrays in URLs. Basic Example Here's a simple demonstration of how http_build_query() works ? field1=test&field2=xyz Laravel Controller Example The following example shows how to use http_build_query() in a Laravel controller to construct URLs with array ...

Read More

Read/Write structure to a file using C

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 13K+ Views

In C programming, structures can be written to and read from files using the fwrite() and fread() functions. This allows you to store complex data types persistently and retrieve them later. fwrite() Syntax size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream); Parameters: ptr − A pointer to the data to be written size − Size in bytes of each element nmemb − Number of elements to write stream − Pointer to the FILE object fread() Syntax size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream); ...

Read More

How to get the last inserted ID using Laravel Eloquent?

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 15-Mar-2026 17K+ Views

Eloquent is Laravel's object relational mapper (ORM) that helps interact with databases. Each table has a mapping Model that handles all operations on that table. When you need to insert data and get the ID of the newly created record, Laravel provides several methods to retrieve the last inserted ID. Syntax Using Laravel Eloquent model, you can use the insertGetId() method to get the inserted ID − Model::insertGetId([field=>value, field2=>value…]) The method insertGetId() returns the last inserted ID from the table. Using insertGetId() with Eloquent Model The simplest approach to get the last ...

Read More

How can I get the list of files in a directory using C or C++?

Revathi Satya Kondra
Revathi Satya Kondra
Updated on 15-Mar-2026 17K+ Views

Listing files in a directory is used to write a program that opens a specified folder (e.g: "/myfiles"), reads its contents, and displays the names of each file and subfolder one by one. In C, to see all the files in a directory, you can use special system functions that let you read the directory's contents. In real life, we open folder to see the contents inside the files. Similarly, in C, we can write a program to display all the files and folders in a directory. Syntax DIR *opendir(const char *dirname); struct dirent *readdir(DIR ...

Read More

How to select certain fields in Laravel Eloquent?

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 15-Mar-2026 8K+ Views

Laravel Eloquent provides several methods to select specific fields from database tables instead of retrieving all columns. This approach improves performance by reducing memory usage and network traffic. Using select() Method The select() method allows you to specify which fields to retrieve − The output of the above code is − Siya Khan=>siya@gmail.com This is equivalent to the SQL query − SELECT name, email FROM users WHERE id=1; Using get() with Field Array Another approach is passing field names directly to the get() method ...

Read More
Showing 9911–9920 of 21,090 articles
« Prev 1 990 991 992 993 994 2109 Next »
Advertisements